本文介绍了如何选择所有表单元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我通常只是这样做:
$("#formid input, #formid select, #formid textarea")
但是这有什么捷径吗?.
But is there any shorthand for this, like..
$("#formid All-Form-Elements")
?
推荐答案
您似乎正在寻找 :input 选择器:
You seem to be looking for the :input selector:
var formElements = $("#formid :input");
请注意,它也匹配<button>
元素.
Note that it also matches <button>
elements.
这篇关于如何选择所有表单元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!