Multiple not() DOM Selectors

css, dom, javascript, jquery, selector

Solution

not 10008 and also it does not …

That's not what your current selector checks, it test whether it has not ( the id and a style attribute ) . Use this instead:

div[id*='0008']:not([id='10008']):not([style])

Your original solution also was not a valid selector, since `:not()` may only contain one simple selector, while you had two of them. Yet, selector libraries like jQuery's sizzle engine might support them. So with jQuery, the following would work as well:

div[id*='0008']:not([id='10008'],[style])

Problem

I want to select a particular node with two not clauses, but I had no success so far. What I need to do is, select an element whose div contains the string 0008, but it's not 10008 and also it does not contain the tag "style", so, in theory it should work like that: ``` document.querySelectorAll(" div[id*='0008']:not([id='10008'][style])") ``` However, as you might suspect, it doesn't work that way. ``` document.querySelectorAll(" div[id*='0008']:not([id='10008'])") document.querySelectorAll(" div[id*='0008']:not([style])") ``` Both of them work perfectly individually, of course.

Original source