Javascript DOM HTML Input Time step Property get

Introduction

Get the number intervals for seconds in a time field:

var x = document.getElementById("myTime").step;

Click the button to display the value of the step attribute of the time field for seconds interval.

View in separate window

<!DOCTYPE html>
<html>
<body>

Time: <input type="time" id="myTime" step="5">
<button onclick="myFunction()">Test</button>

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

<script>
function myFunction() {/*from ww  w.j  a  v  a2  s  .c o m*/
  var x = document.getElementById("myTime").step;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related