JQuery 选择器逻辑“与”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5234462/
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
JQuery selector logical "and"
提问by Mandoleen
How can I access elements that have name X
and type hidden
?
如何访问具有 nameX
和 type 的元素hidden
?
回答by Amir Raminfar
You should try this if you want type=hidden
如果你愿意,你应该试试这个 type=hidden
$('input[name="X"][type="hidden"]')
If you want an element that is hidden via css then you should try
如果你想要一个通过 css 隐藏的元素,那么你应该尝试
$('[name="X"]:hidden')
回答by StuperUser
$('[type="hidden"][name="X"]');
回答by Surreal Dreams
$('[name="X"]:hidden').dosomething();
This will select an element with a name="X"
attribute which is hidden. You can learn lots more about jQuery selectors- there's plenty of useful help there.
这将选择具有name="X"
隐藏属性的元素。您可以了解有关jQuery 选择器的更多信息- 那里有很多有用的帮助。