adrian collins adrian collins - 3 days ago 5
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

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

Comments