Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Input Color disabled attribute

Input Color disabled attribute

Input Color Object Reference Input Color Object

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

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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
  • true - the color picker is unavailable
  • false - default. 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 Reference Input Color Object