I have such html:
<li>
<a href="#">2012: Ice Age</a>
<br>
<a href="#"> blah blah </a>
<br>
This text should disappear!!!
</li>
How to I remove that text with Jquery? I don’t have a control over this code, so I cannot add any IDs for easier selection..
If it is at the end, you can use the
contents()[docs] method (which gets all children, including text nodes, and thelast()[docs] method to target the last one.Example: http://jsfiddle.net/KtTfQ/
EDIT:
You could also just empty the content of that text node:
Example: http://jsfiddle.net/KtTfQ/2/