English 中文(简体)
j Query Wrap a pesticide after, Append or Regex?
原标题:jQuery Wrap a strike After, Append or Regex?

我想通过JUST增加一个带有特殊等级的标签的价格特征。 之所以难以做到,是因为《刑法》的制定方式是使《价格》得以实现,而不是提交给它的案文:

如果我能够总结一下在特别人物AFTER font.colors_text or NOT font.colors_text中发生的一切,那就是什么样?

我有:

<font class="pricecolor colors_productprice specialprice">
   <font class="text colors_text">
      <b>Regular Price:<br></b>
   </font>
   $2,492<sup>.38</sup>
</font>

我希望:

<font class="pricecolor colors_productprice specialprice">
   <font class="text colors_text">
      <b>Regular Price:<br></b>
   </font>
   <strike>$2,492<sup>.38</sup></strike>
</font>
最佳回答

在您的社保协会中,增加一门罢工课:

.strike {text-decoration: line-through;}

阁下:

// get all the children of pricecolor, filter out the colors_text children,
// and wrap the span of price around them
$(".pricecolor").contents().each(function() {
    if(!$(this).is(".colors_text")) {
        $(this).wrap("<span class= price >");
    }
});

$(".price").addClass("strike");

如果你在网页上有多种价格,你可能希望用一个身份证,给每个价格一个独特的身份证。

问题回答

j 质量。 总结是,如果我不能改变沉默,就开始使用。

(未经过测试)

首先,使用<代码>。

var list = $("span.pricecolor").children();
list.not(list.first());
list.wrap($("<strike></strike>"));

由于浏览器在接触儿童内容方面缺乏一致性,你可以使用Regex:

$(".specialprice").html($(".specialprice").html().replace(/</font>(.*</sup>)/i, "</font><strike>$1</strike>"));




相关问题
Uncommon regular expressions [closed]

Recently I discovered two amazing regular expression features: ?: and ?!. I was curious of other neat regex features. So maybe you would like to share some tricky regular expressions.

regex to trap img tag, both versions

I need to remove image tags from text, so both versions of the tag: <img src="" ... ></img> <img src="" ... />

C++, Boost regex, replace value function of matched value?

Specifically, I have an array of strings called val, and want to replace all instances of "%{n}%" in the input with val[n]. More generally, I want the replace value to be a function of the match ...

PowerShell -match operator and multiple groups

I have the following log entry that I am processing in PowerShell I m trying to extract all the activity names and durations using the -match operator but I am only getting one match group back. I m ...

Is it possible to negate a regular expression search?

I m building a lexical analysis engine in c#. For the most part it is done and works quite well. One of the features of my lexer is that it allows any user to input their own regular expressions. This ...

regex for four-digit numbers (or "default")

I need a regex for four-digit numbers separated by comma ("default" can also be a value). Examples: 6755 3452,8767,9865,8766,3454 7678,9876 1234,9867,6876,9865 default Note: "default" ...

热门标签