jQuery“非只读”选择器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3708764/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 15:56:54  来源:igfitidea点击:

jQuery "not readonly" selector

jqueryjquery-selectors

提问by fearofawhackplanet

I'm looking for something along the lines of...

我正在寻找类似...

$(':input:not(readonly)') // all inputs which are not readonly

but struggling to find the syntax.

但很难找到语法。

Any pointers? thanks

任何指针?谢谢

回答by halfdan

This should work:

这应该有效:

$(":input:not([readonly])")

回答by Adrian Garner

$('input:not([readonly])')

would cover readonly, readonly="true" and readonly="readonly"

将涵盖 readonly、readonly="true" 和 readonly="readonly"

回答by Sphygmomanometer

I recently did something similar like this:

我最近做了类似这样的事情:

$('#element').find(':input').not(':input[readonly]');

回答by jwueller

I suppose you are looking for something like the following:

我想您正在寻找类似以下内容的内容:

$('input:not([readonly="readonly"])')

Have a look at jQuery's various attribute-selectors.

看看 jQuery 的各种属性选择器

回答by Florin

I would like to add another answer that works for me, using context https://api.jquery.com/context/

我想添加另一个对我有用的答案,使用上下文https://api.jquery.com/context/

$(this).context.readOnly == false / true