jquery remove text between tags -
i have such html:
<li> <a href="#">2012: ice age</a> <br> <a href="#"> blah blah </a> <br> text should disappear!!! </li>
how remove text jquery? don't have control on code, cannot add ids easier selection..
$('li').contents().last().remove();
if @ end, can use contents()
[docs] method (which gets children, including text nodes, , last()
[docs] method target last one.
example: http://jsfiddle.net/kttfq/
edit:
you empty content of text node:
$('li br:last-child')[0].nextsibling.nodevalue = '';
example: http://jsfiddle.net/kttfq/2/
Comments
Post a Comment