Input Checkbox disabled Attribute
Definition and Usage
disabled
Sets or returns whether the checkbox should be disabled.
Disabled elements are not available and cannot be clicked. By default, disabled elements are usually displayed in gray in the browser.
This property reflects the HTML disabled attribute.
See also:
HTML Reference Manual:HTML <input> disabled Attribute
Example
Example 1
Disable checkbox:
document.getElementById("myCheck").disabled = true;
Example 2
Check if the checkbox is disabled:
var x = document.getElementById("myCheck").disabled;
Example 3
Enable and disable checkboxes:
function disable() { document.getElementById("myCheck").disabled = true; } function undisable() { document.getElementById("myCheck").disabled = false; }
Syntax
Return the disabled attribute:
checkboxObject.disabled
Set the disabled attribute:
checkboxObject.disabled = true|false
Attribute Value
Value | Description |
---|---|
true|false |
Specifies whether the checkbox should be disabled Possible values:
|
Technical Details
Return value: | Boolean value, returned if the checkbox is disabled true , otherwise return false . |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |