多个值的jQuery属性选择器
鉴于以下html,是否有一个选择器允许我根据type
获得两者?
$('input[type=text || button]'); //for example, double pipes as an OR does not work
我浏览了文档,但是我找不到任何关于使用逻辑运算符或提供匹配列表的方法的能力。
这应该有所帮助:
$('input[type="text"], input[type="button"]');
试试这个
$("input:text, input:button");