Skip to content
Advertisement

Tag: native-methods

Check element against querySelector? (using native methods, not JQuery)

I have an Element. I would like to check whether it meets a particular query, eg (‘.someclass’) in the same kind of style as querySelector. This isn’t as easy as it sounds. Element.querySelectorAll and Element.querySelector only work on descendents of the element in question. Not the element itself. Note: The line above is for illustration purposes only. In real life,

Advertisement