如何禁用所有< input> jQuery的表单内部? [英] How to disable all <input > inside a form with jQuery?
本文介绍了如何禁用所有< input> jQuery的表单内部?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<form id="target">
....
</form>
推荐答案
在旧版本中,您可以使用 attr
.从jQuery 1.6开始,您应该使用 prop
:
In older versions you could use attr
. As of jQuery 1.6 you should use prop
instead:
$("#target :input").prop("disabled", true);
禁用目标"内的所有表单元素.参见 :input
:
To disable all form elements inside 'target'. See :input
:
匹配所有输入,文本区域,选择和按钮元素.
Matches all input, textarea, select and button elements.
如果只需要<input>
元素:
$("#target input").prop("disabled", true);
这篇关于如何禁用所有< input> jQuery的表单内部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文