7 thoughts on “How to disable or enable a form element with jQuery?”
Ty very much!
Very useful, thanks.
The jQuery docs say to use prop() for things like disabled, checked, etc. Also the more concise way is to use their selectors engine. So to disable all form elements in a div or form parent.
And to enable again.
If you have one field to change, uou can also do it with $(‘#checkboxfield’).disabled = true
Beware of disabling form elements….. they won’t be seen in the server side……
I created a widget that can completely disable or present a read-only view of the content on your page. It disables all buttons, anchors, removes all click events, etc., and can re-enable them all back again. It even supports all jQuery UI widgets as well. I created it for an application I wrote at work. You’re free to use it.
Check it out at ( http://www.dougestep.com/dme/jquery-disabler-widget ).
Comments are closed.