1. ホーム
  2. jquery

[解決済み] How to disable all <input > inside a form with jQuery?

2022-04-26 17:05:46

Question

<form id="target">
....
</form>

How to solved?

In older versions you could use attr . As of jQuery 1.6 you should use prop instead:

$("#target :input").prop("disabled", true);

To disable all form elements inside 'target'. See :input :

Matches all input, textarea, select and button elements.

If you only want the <input> 要素を使用します。

$("#target input").prop("disabled", true);