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

Introduction

Increment the weeks by 1 (default):

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

Click the button to increment the value of the week field by 1 week.

This is the same as clicking the up 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() {//  w w  w  .  j  a v  a2s  .  c o m
  document.getElementById("myWeek").stepUp();
}
</script>

</body>
</html>



PreviousNext

Related