Input Color disabled attribute

Definition and usage

disabled Attribute 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:Propriedade disabled do <input> no 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 true,caso contrário, retorna false.

Suporte do navegador

Os números na tabela indicam a versão do navegador que suporta completamente essa propriedade.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Suporte 10.0 Suporte Suporte Suporte

Atenção:O elemento <input type="color"> não exibe nenhum seletor de cor no Internet Explorer e Safari.