Input Color disabledProperty

Input Color 对象参考手册Input Color Object

Example

Disable the color picker:

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

Output result:


Try it yourself »

Definition and Usage

The disabled property is used to set or return whether the color picker is available.

Elements using the disabled attribute are unavailable and unclickable. Disabled elements are usually displayed in gray in the browser.

This property reflects the HTML disabled attribute.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the disabled property.

Note:Internet Explorer and Safari do not support the <input type="color"> element.


Syntax

Return the disabled property:

colorObject.disabled

Set the disabled property:

colorObject.disabled=true|false

Property Values

Value Description
true|false Describes whether the color picker is available
  • true - The color picker is unavailable
  • false - Default. The color picker is available.

Technical Details

Return value: Boolean, 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;
xOutput result:
true

Try it yourself »

Example

Disable or enable the color picker:

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

Try it yourself »


Related Articles

HTML Reference Manual:HTML <input> disabled Attribute


Input Color 对象参考手册Input Color Object Other Extensions