Javascript DOM HTML Input Time step Property set milliseconds interval

Introduction

Change the number intervals for milliseconds in a time field:

document.getElementById("myTime").step = ".050";

Click the button to change the value of the step attribute of the time field for milliseconds interval.

View in separate window

<!DOCTYPE html>
<html>
<body>

Time: <input type="time" id="myTime" step=".1">
<button onclick="myFunction()">Test</button>
<p id="demo"></p>

<script>
function myFunction() {// w  ww . j  av  a 2s . c  om
  document.getElementById("myTime").step = ".050";
  document.getElementById("demo").innerHTML = "The value of the step attribute was changed.";
}
</script>

</body>
</html>



PreviousNext

Related