Input Color disabled Attribute

Definition and Usage

disabled Sets or returns whether the color selector 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 the color selector:

document.getElementById("myColor").disabled = true;

Try It Yourself

Example 2

Check if the color selector is disabled:

var x = document.getElementById("myColor").disabled;

Try It Yourself

Example 3

Enable and disable the color selector:

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

Try It Yourself

Syntax

Return the disabled attribute:

colorObject.disabled

Set the disabled attribute:

colorObject.disabled = true|false

Attribute Value

Value Description
true|false

Specifies whether the color selector should be disabled.

  • true - The color selector is disabled
  • false - Default. The color selector is not disabled

Technical Details

Return value: Boolean value, returned if the color selector is disabled true, otherwise return false.

Browser Support

The numbers in the table indicate the first browser version that fully supports this attribute.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support

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