HTML DOM Input Color disabled Property

HTMLWeb DevelopmentFront End Technology

The HTML DOM Input Color disabled property sets/returns whether Input Color is enabled or disabled.

Syntax

Following is the syntax −

  • Returning boolean value - true/false
inputColorObject.disabled
  • Setting disabled to booleanValue
inputColorObject.disabled = booleanValue

Boolean Values

Here, “booleanValue” can be the following −

booleanValueDetails
trueIt defines that the input color is disabled.
falseIt defines that the input color is not disabled and it is also the default value.

Example

Let us see an example of Input Color disabled property −

 Live Demo

<!DOCTYPE html>
<html>
<head>
<title>Input Color Disabled</title>
</head>
<body>
<form>
Color Picker: <input type="color" id="Color" disabled>
</form>
<button onclick="enableColorInput()">Enable Color Input</button>
<div id="divDisplay"></div>
<script>
   var divDisplay = document.getElementById("divDisplay");
   var inputColor = document.getElementById("Color");
   divDisplay.textContent = 'Color Input disabled: '+inputColor.disabled;
   function enableColorInput() {
      inputColor.disabled = false;
      divDisplay.textContent = 'Color Input disabled: '+inputColor.disabled;
   }
</script>
</body>
</html>

Output

This will produce the following output −

Before clicking ‘Enable Color Input’ button −

After clicking ‘Enable Color Input’ button −

raja
Published on 19-Jul-2019 12:15:15
Advertisements