Input Month stepDown() Method - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Month

Description

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

Parameter Values

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

If omitted, the months are decremented by "1"

Return Value:

No return value

The following code shows how to Decrement 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 2 s. c  o m*/
    document.getElementById("myMonth").stepDown(3);
}
</script>

</body>
</html>

Related Tutorials