jQuery 多个值的jQuery属性选择器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9005361/
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-27 10:11:28  来源:igfitidea点击:

jQuery attribute selector for multiple values

jqueryjquery-selectors

提问by mrtsherman

Given the following html, is there a selector that allows me to get both based on type?

鉴于以下 html,是否有一个选择器可以让我基于type?

<input type="text"  />
<input type="button"  />

 

 

$('input[type=text || button]'); //for example, double pipes as an OR does not work 

I went through the docs, but I couldn't find anything on the ability to use logical operators or a means of providing a matching list.

我浏览了文档,但找不到任何有关使用逻辑运算符的能力或提供匹配列表的方法的信息。

回答by jabclab

This should help:

这应该有帮助:

$('input[type="text"], input[type="button"]');

回答by ShankarSangoli

Try this

尝试这个

$("input:text, input:button");