Javascript DOM HTML Input Color disable and enable a color picker

Introduction

Disable and enable a color picker:

View in separate window

<!DOCTYPE html>
<html>
<body>
<input type="color" id="myColor"><br><br>

<button onclick="disableBtn()">Disable Color Picker</button>
<button onclick="enableBtn()">enable Color Picker</button>
<script>
function disableBtn() {//from ww  w  .  j  a  va  2 s .  c o m
  document.getElementById("myColor").disabled = true;
}

function enableBtn() {
  document.getElementById("myColor").disabled = false;
}
</script>

</body>
</html>



PreviousNext

Related