instance method Form.Element#disable

View source on GitHub →

Form.Element#disable() → Element

Disables a form control, effectively preventing its value from changing 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.

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.

This method can be called either as an instance method or as a generic method. If calling as a generic, pass the instance in as the first argument.