jQuery属性选择器,用于多个值 [英] jQuery attribute selector for multiple values
本文介绍了jQuery属性选择器,用于多个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
鉴于以下html,是否有一个选择器可让我基于type
获得这两者?
Given the following html, is there a selector that allows me to get both based on 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.
推荐答案
这应该有所帮助:
$('input[type="text"], input[type="button"]');
这篇关于jQuery属性选择器,用于多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文