html - jQuery add first part of div, then add last part of div seperatley -


i'm trying wrap following prices , text together, in 1 div.

this have:

<table cellspacing="0" cellpadding="0" border="0" class="theprices">      <tbody><tr>        <td>           <font class="text colors_text">              <b>msrp: <span class="priceis">$90.00</span></b>           </font><br>           <b><font class="pricecolor colors_productprice">                  <font class="text colors_text"><b>burkett price:</b></font>                  <span class="priceis">$289<sup>.99</sup></span>              </font>           </b><br>           <a href="a link">a link goes here</a>           <table>a table stuff goes here</table>        </td>       </tr></tbody> </table> 

this trying get:

<table cellspacing="0" cellpadding="0" border="0" class="theprices">          <tbody><tr>            <td>              **<div class="pricebox">**                 <font class="text colors_text">                    <b>msrp: <span class="priceis">$90.00</span></b>                 </font><br>                 <b><font class="pricecolor colors_productprice">                      <font class="text colors_text"><b>burkett price:</b></font>                      <span class="priceis">$289<sup>.99</sup></span>                    </font>                 </b><br>              **</div>**                <a href="a link">a link goes here</a>                <table>a table stuff goes here</table>            </td>           </tr></tbody>     </table> 

this doesnt work idea of i'm doing wrong:

$(document).ready(function () { $('.theprices').find('td').find('font:first').before('<div class="pricebox">'); $('.theprices').find('.colors_productprice').find('b').after('</div>'); }); 

perhaps should using slice?

i think want .wrapall()
updated, use .andself() include <font/>

$('.theprices').find('td').children().first().nextuntil('a').andself().wrapall('<div class="pricebox"></div>'); 

example on jsfiddle


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -