disabled

disabled
Type: boolean
Indicates whether the element is disabled or not. If this element is set to true the element is disabled. Disabled elements are usually drawn with grayed-out text. If the element is disabled, it does not respond to user actions, it cannot be focused, and the command event will not fire.

The element will, however, still respond to mouse events. To enable the element, leave this attribute out entirely as opposed to setting the value to false.
Visible controls have a disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update additional state.
Image:XUL_ref_attr_disabled.png
// Disabling an element
document.getElementById('buttonRemove').setAttribute("disabled", "true");

// Enabling back an element by removing the "disabled" attribute
document.getElementById('buttonRemove').removeAttribute("disabled");

Firefox 3.5 note

For keyset elements, support for this attribute was added in Firefox 3.5.

Attachments

File Size Date Attached by
XUL_ref_attr_disabled.png
2244 bytes 2008-07-01 13:58:09 Marsf
Firefox-1.5-beta2.png
15087 bytes 2005-11-01 18:17:24 RuiMaciel

Document Tags and Contributors

Last updated by: Sheppy,