I am writing a custom script for a forum I frequently visit. It is designed to remove signatures from the board when I view it because they are distracting and annoying and they have no way to disable them in the options.
Anyway, I can run custom scripts using a helpful Chrome extension. I am able to modify any portions of the page where HTML nodes have classes, IDs, or even attributes with a little bit of unique information, but I can’t seem to figure out how to select and remove the following HTML with jQuery.
<tr>
<td colspan="2">
<!--Signature-->
<div class="resultText">
<!-- sig -->
<div>Signature text</div>
<!-- / sig -->
</div>
</td>
</tr>
If there was a way I could grab the parent of <!--Signature--> that would be perfect but I’m not sure that’s even possible.
There is one class resultText but that class is used wherever there is text entered by the user, not just in the signature. So I can’t grab onto that.
You can use
.contents()to get all the child nodes of an element: http://api.jquery.com/contentsFrom the docs:
Here is a demo: http://jsfiddle.net/NLhz9/1/