adrian collins adrian collins - 1 year ago 111
jQuery Question

jquery to remove H1 html snippet

I have a snippet of code I need to remove -

<div class="l-titlebar-content"><h1 itemprop="headline">Text here</h1></div>

A previous question had this answer for removing an H1:

$("nobr.testClass > h1").remove();

so I tried to edit that and swap out the classes to:

$(".l-titlebar-content > h1").remove();

but it is not removing the H1.

Answer Source

Try $(".l-titlebar-content h1").remove(); this will remove all H1 tag in element with class l-titlebar-content

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download