HTML DOM Input Color disabled Property
THE WORLD'S LARGEST WEB DEVELOPER SITE

Input Color disabled Property

❮ Input Color Object

Example

Disable a color picker:

document.getElementById("myColor").disabled = true;
Try it Yourself »

Definition and Usage

The disabled property sets or returns whether a color picker should be disabled, or not.

A disabled element is unusable and un-clickable. Disabled elements are usually rendered in gray by default in browsers.

This property reflects the HTML disabled attribute.


Browser Support

Property
disabled Yes 10.0 Yes Yes Yes

Note: The <input type="color"> element does not show any colorpicker in Internet Explorer and Safari.


Syntax

Return the disabled property:

colorObject.disabled

Set the disabled property:

colorObject.disabled = true|false

Property Values

Value Description
true|false Specifies whether a color picker should be disabled or not
  • true - The color picker is disabled
  • false - Default. The color picker is not disabled


Technical Details

Return Value: A Boolean, returns true if the color picker is disabled, otherwise it returns false

More Examples

Example

Find out if a color picker is disabled or not:

var x = document.getElementById("myColor").disabled;
Try it Yourself »

Example

Disable and undisable a color picker:

function disableBtn() {
    document.getElementById("myColor").disabled = true;
}
function undisableBtn() {
    document.getElementById("myColor").disabled = false;
}
Try it Yourself »

Related Pages

HTML reference: HTML <input> disabled attribute


❮ Input Color Object