I’m writing a bookmarklet for a jQuery-based product listing site, and I need to traverse the cells of a table that contain a product description with cost, and then separate that pricing info into its own cell.
<tr>
<td>
<div class="item" id="item-67601">Cricut Expression Cutting Machine - $119.00 <span class="db">*</span>
</div>
</td>
</tr>
What I don’t know how to do, at least not using jQuery (or any jQ plugin), is to parse out that price info, so that I can append it to a new adjacent table cell.
How might I go about doing this? Is there perhaps a simpler way to do it with native JS instead, or in addition? I’m curious what my options are.
Maybe just split on
- $so you have an array with the name, and the price.Something like
Live example: http://jsfiddle.net/WPy7p/1/
With regular expression:
Live example: http://jsfiddle.net/WPy7p/3/