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:Atributo disabled del elemento <input> de HTML

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

Disable and enable 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 truede lo contrario, regresa false.

Compatibilidad del navegador

Los números en la tabla indican la versión del navegador que admite completamente la propiedad.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Compatibilidad 10.0 Compatibilidad Compatibilidad Compatibilidad

Atención:El elemento <input type="color"> no muestra ningún selector de colores en Internet Explorer y Safari.