Javascript DOM HTML Input Color disabled Property set

Introduction

Disable a color picker:

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

Click the button to disable the color picker above.

View in separate window

<!DOCTYPE html>
<html>
<body>
<input type="color" id="myColor">
<button onclick="myFunction()">Test</button>
<script>
function myFunction() {/*w  w w.  j a  va  2 s.  c  o  m*/
  document.getElementById("myColor").disabled = true;
}
</script>

</body>
</html>

The disabled property sets or gets whether a color picker should be disabled, or not.

This property mirrors the HTML disabled attribute.

The disabled property accepts and returns a boolean type.

Value Description
trueThe color picker is disabled
falseDefault. The color picker is not disabled



PreviousNext

Related