There were problems with the attribute! = Selector

The question is simple, the answer may be wrong.

I am trying to apply multiple styles to all input elements without a specific identifier. I use this selector in my CSS stylesheet: input[id!='move'] , but unfortunately it doesnโ€™t work in IE10 or Chrome.

Curiously, this: input:not(#move) works fine in both. I got lost, because the first block of code should work, as far as I understand how these selectors work.

Any ideas?

+6
source share
1 answer

This is a non-standard attribute selector invented by jQuery . It is not part of the selectors specification , so it will not work anywhere outside of jQuery (this includes things like document.querySelectorAll() ).

Strictly speaking, the direct equivalent of jQuery input[id!='move'] in the standard selector syntax is input:not([id='move']) , with an attribute selector. But since you want to combine elements without a specific identifier, input:not(#move) is fine.

+6
source

Source: https://habr.com/ru/post/950443/


All Articles