Javascript examples for DOM HTML Element:Input Month
The stepDown() method decrements the MONTHS value of the month field by a specified number.
Parameter | Description |
---|---|
number | Required. amount of months the month field should decrease. |
If omitted, the months are decremented by "1"
No return value
The following code shows how to Decrement the value of a month field by 3 months:
<!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>