Input Month stepUp() Method - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Month

Description

The stepDown() method increments the MONTHS value of the month field by a specified number.

Parameter Values

Parameter Description
numberRequired. amount of months the month field should increase.

If omitted, the months are incremented by "1"

Return Value:

No return value

The following code shows how to Increment the value of a month field by 3 months:

Demo Code

ResultView the demo 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 .j av a  2s.co  m
    document.getElementById("myMonth").stepUp(3);
}
</script>

</body>
</html>

Related Tutorials