Let's say I have a page with several h2 tags. I want to get all h2 tags that do not have css class.
So in this example:
<h2>Headline 1</h2> <p>content 1</p> <h2 class="some-class">Headline 2</h2> <p>content 2</p> <h2>Headline 3</h2> <p>content 3</p> <h2 class="another-class">Headline 4</h2> <p>content 4</p>
I want the h2 elements to wrap "Heading 1" and "Heading 3" in the above example.
Performing this action:
var h2_tags = $("h2");
The result is all of H2, which I donβt want. How can I get only those who don't have a CSS class?
source share