Javascript DOM HTML Input Month step Property get

Introduction

Get the legal month intervals:

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

Click the button to display the value of the step attribute of the month field.

The step property is not supported in Firefox.

View in separate window

<!DOCTYPE html>
<html>
<body>

Month: <input type="month" id="myMonth" step="3">

<button onclick="myFunction()">Test</button>
<p id="demo"></p>

<script>
function myFunction() {/* ww  w  .  jav  a  2  s  . c  o  m*/
  var x = document.getElementById("myMonth").step;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related