Javascript DOM HTML Input Time min Property set

Introduction

Change the minimum value:

document.getElementById("myTime").min = "16:00";

Click the button to change the value of the min attribute of the time field.

View in separate window

<!DOCTYPE html>
<html>
<body>

Time: <input type="time" id="myTime" min="20:00" max="22:00">
<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {//from  www  .j a v a 2 s.c  om
  var x = document.getElementById("myTime").min = "16:00";
  document.getElementById("demo").innerHTML = "The value of the min attribute was changed.";
}
</script>

</body>
</html>



PreviousNext

Related