与属性!=选择器有问题 [英] Having trouble with attribute != selector
问题描述
问题很简单,答案可能不是。
The question is simple, the answer maybe not.
我试图对没有特定id的所有输入元素应用多个样式。我在CSS样式表中使用这个选择器: input [id!='move']
但不幸的是它不能在IE10或Chrome中工作。
I'm trying to apply several styles to all input elements without an specific id. I use this selector in my CSS stylesheet: input[id!='move']
but unfortunately it's not working either in IE10 or in Chrome.
奇怪的是,这个块: input:not(#move)
我失去了,因为第一块代码应该工作,只要我明白这些类型的选择器是如何工作的。
The curious thing is that this block: input:not(#move)
works perfectly in both.
I'm lost because the first block of code is supposed to work as far as I understand how these kind of selectors work.
任何想法? p>
Any ideas?
推荐答案
这是一个非标准属性选择器由jQuery发明。它不是选择器规范的一部分,因此它不会在jQuery之外的任何位置工作包括 document.querySelectorAll()
)。
That is a non-standard attribute selector invented by jQuery. It's not part of the Selectors specification, so it won't work anywhere outside of jQuery (this includes things like document.querySelectorAll()
).
严格来说,jQuery的<$ c $在标准选择器语法中的c> input [id!='move'] 是 input:not([id ='move'])
属性选择器。但由于您要查找匹配没有特定ID的元素,输入:not(#move)
很好。
Strictly speaking, the direct equivalent of jQuery's input[id!='move']
in standard selector syntax is input:not([id='move'])
, with an attribute selector. But since you're looking to match elements without a specific ID, input:not(#move)
is fine.
这篇关于与属性!=选择器有问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!