与属性!=选择器有问题 [英] Having trouble with attribute != selector

查看:96
本文介绍了与属性!=选择器有问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题很简单,答案可能不是。

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆