disable
disable(element) -> HTMLElement
Disables a form control, effectively preventing its value to be changed until it is enabled again.
This method sets the native disabled
property of an element to true
. You can use this property to check the state of a control.
Example
See the interactive example in the Form.disable() method, which is basically it.
Notes
Disabled form controls are never serialized.
Never disable a form control as a security measure without having validation for it server-side. A user with minimal experience of JavaScript can enable these fields on your site easily using any browser. Instead, use disabling as a usability enhancement - with it you can indicate that a specific value should not be changed at the time being.