I’m trying to develop a greasemonkey script that removes a bar from a site, so far, I’ve maganged to remove the class itself, but I cannot remove the content within the div. I can remove all ul elements in the entire site, but I only need to remove all specific elements associated with “bar” div class and the ul inside doesn’t have an ID, so I can’t track it by JQuery. How do I remove the elements ?
<div class="bar"> <ul>
<a href="..." onclick=""/>
<span class="title">Title 1</span>
</a>
<a href="..." onclick=""/>
<span class="title">Title 2</span>
</a></ul></div>
This is what I have so far in JQuery
$(".bar").removeClass('bar');
I’ve tried this, but it removes all the UL elements in the entire page and I don’t want that
$('ul:not(:first):not(:last)').remove();
You want this:
jQuery('ancestor descendant')docs