FAQ Database Discussion Community


Invalid selector with querySelectorAll :not with descendants

javascript,css-selectors,queryselectorall
I've got a case where I need to select different groups of nodes on a page, and I need to exclude certain child elements. My most common task is selecting all <img> elements, but not some that are descendants of certain elements. Take for example my fiddle here: http://jsfiddle.net/rjdbys13/ I...

Is it possible to make querySelectorAll live like getElementsByTagName?

javascript,dom,css-selectors,getelementsbytagname,queryselectorall
getElementsByTagName() has 2 great features: it is fast and it is live. But what if I want to get p strong. Of course I could refine a selection using getElementsByTagName() again but wouldn't I loose the live effect for the new p tags? Is there a way to turn querySelectorAll...

How to get the div that has a duplicated id using querySelector()?

javascript,dom,queryselectorall
I have a <div> and a <video> that both have the same id: <div id="id1"> Some content </div> <video id="id1"> <source></source> </video> It is not possible for me to change the IDs of the div or the video. The div is created automatically by the video.js library, which gives both...

How to select the