Javascript DOM HTML Input Time disable and enable

Introduction

Disable and enable a time field:

View in separate window

<!DOCTYPE html>
<html>
<body>

<input type="time" id="myTime"><br><br>

<button onclick="disableBtn()">Disable Time Field</button>
<button onclick="enableBtn()">enable Time Field</button>

<script>
function disableBtn() {//from   ww  w . j  ava  2s  .c  om
  document.getElementById("myTime").disabled = true;
}

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

</body>
</html>



PreviousNext

Related