Javascript DOM HTML Input DatetimeLocal step Property set milliseconds

Introduction

Change the legal number intervals for milliseconds in a local date field:

document.getElementById("myLocalDate").step = ".020";

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

View in separate window

<!DOCTYPE html>
<html>
<body>

Date: <input type="datetime-local" id="myLocalDate" step=".1">
<button onclick="myFunction()">Test</button>
<p id="demo"></p>

<script>
function myFunction() {/*from   www  .j  a v  a2  s .  c  om*/
  document.getElementById("myLocalDate").step = ".020";
  document.getElementById("demo").innerHTML = "The value of the step attribute was changed from '.1' to '.050'.";
}
</script>

</body>
</html>



PreviousNext

Related