Input Color disabled attribute
Example
Disable the color picker:
document.getElementById("myColor").disabled = true;
Output result:
Try it »
Definition and Usage
The disabled attribute is used to set or return whether the color picker is available.
Elements with the disabled attribute are unavailable and not clickable. Disabled elements are usually displayed in gray in the browser.
This attribute reflects the HTML disabled attribute.
Browser support





All major browsers support the disabled attribute.
**Note:** Internet Explorer and Safari browsers do not support .
Syntax
Return the disabled attribute:
colorObject
.disabled
Set the disabled attribute:
colorObject
.disabled=true|false
Attribute values
| Value | Description |
|---|---|
| true|false | Describes whether the color picker is available
|
Technical Details
| Return Value: | Boolean value, returns true if the color picker is disabled, otherwise returns false. |
|---|
More examples
Example
Check whether the color picker is available:
var x = document.getElementById("myColor").disabled;
x
The output is:
true
Try it »
Example
Disable or enable the color picker:
function disableBtn() {
document.getElementById("myColor").disabled = true;
}
function undisableBtn() {
document.getElementById("myColor").disabled = false;
}
Try it »
Related Articles
HTML Reference Manual: HTML disabled attribute
Input Color Object