Javascript DOM HTML Input Month stepUp() Method with default parameter

Introduction

Increment the value of a month field by 1 (default):

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

The stepUp() method is not supported by Firefox.

View in separate window

<!DOCTYPE html>
<html>
<body>

Month and year: <input type="month" id="myMonth" value="1997-11">
<button onclick="myFunction()">Test</button>
<script>
function myFunction() {/*  ww w.  jav a2  s.  c om*/
  document.getElementById("myMonth").stepUp();
}
</script>

</body>
</html>



PreviousNext

Related