How to disable or enable a form element with jQuery?

by kalai 2010-02-01 12:13:55



You need 2 jQuery functions: attr and removeAttr.

To disable a form element such as a text input or a button (with a made-up id: #elm):

$("#elm").attr("disabled", "disabled");

To enable a disabled form element:

$("#elm").removeAttr("disabled");

Tagged in:

1020
like
0
dislike
0
mail
flag

You must LOGIN to add comments