Javascript DOM HTML Input Week step Property get

Introduction

Get the legal week intervals:

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

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

input elements with type="week" are not supported in Internet Explorer or Firefox.

View in separate window

<!DOCTYPE html>
<html>
<body>

Week: <input type="week" id="myWeek" step="3">

<button onclick="myFunction()">Test</button>


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

<script>
function myFunction() {// ww  w  .j  a  v  a  2 s  .co  m
  var x = document.getElementById("myWeek").step;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related