Javascript DOM HTML Input Week stepDown() Method with default value

Introduction

Decrement the weeks by 1 (default):

document.getElementById("myWeek").stepDown();

Click the button to decrement the value of the week field by 1 week (each time you click).

This is the same as clicking the down arrow on the right side of the week field for the "week" section.

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

View in separate window

<!DOCTYPE html>
<html>
<body>
<input type="week" id="myWeek" value="2014-W15">
<button onclick="myFunction()">Test</button>
<script>
function myFunction() {//from  w  w  w. j a  v  a 2s .c  o m
  document.getElementById("myWeek").stepDown();
}
</script>

</body>
</html>



PreviousNext

Related