If I have the following markup, how can I change just the text within the parent span - with either javascript or jQuery?
<td class="cartItemTotal">
<span>
<span class="currency_sign">£</span>
25.00
</span>
</td>
I tried the following two (based on two different SO questions), but nothing happens with either.
(1)
$this.find('.cartItemTotal > span').contents().filter(function(){
return this.nodeType == 3;
}).filter(':first').replaceWith( itemTotal.toFixed(2) );
(2)
$this.find('.cartItemTotal > span')[0].firstChild.data = itemTotal.toFixed(2);
NB: "$this
" refers to the current <tr>
the table data element resides in.