jQuery Wrap a strike After, Append or Regex? -


i want add strike tag through price characters of font tag class 'specialprice'. hard because of way code set price , not text before it:

what if wrap in strike in 'specialprice' after font.colors_text or not font.colors_text, that?

i have this:

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

i want this:

<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> 

in css, add class strikethroughs:

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

and in jquery:

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

for selector of price strikethrough may want use id, giving each price unique id, if have many prices on page.


Comments