If I have a reference to a link in Javascript / jQuery, how can I check if it is an <h1>, <h2>, etc.?
I assume you mean inside a heading. You can use :header for that, example:
<h1><a href="#" id="link">link</a></h1>
var isHeading = !!$('#link').closest(':header').length;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With