i have a label tag and i want to remove text between <label> </label>
my string (html code) is
<label style="cursor: pointer; " for="31">
<img src="/joomla_1.7/images/stories/virtuemart/product/resized/black4_90x90.png" alt="the"/>
<span class="vm-img-desc" style="display: none; ">the</span>
$12.93
</label>
i want to remove $12.93 and i just want to image and the span in to <label> </label> tag
i am using php and jQuery
For this specific case Just to remove the
$12.95You can doDemo: http://jsfiddle.net/joycse06/gFgF3/
Read more on .contents()
As it’s not inside any tag it’s a
textNode.contents()returns all child elements including textnodes and in this case$12.95 textNodeis the last child of label, So it will just remove that text( Price in this case).