Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试做类似的事情:
$(".test").find("button or input[type=button]")
我怎样才能做到这一点?
是的,它被称为多重选择器,它是一个逗号:
$(".test").find("button, input[type=button]")
为了完整起见,请注意,:button这正是这样做的,但在几乎所有现代浏览器中都会变慢。
:button
只需使用逗号即$(".test").find("button, input[type=button]");
$(".test").find("button, input[type=button]");