Javascript examples for DOM HTML Element:Input Month
The max property sets or gets the max attribute of a month field, which controls the maximum month and year for a month field.
Set the max property with the following Values
Value | Description |
---|---|
YYYY-MM | Sets the maximum month and year allowed. |
A String, representing the maximum month and year allowed
The following code shows how to get the maximum month and year allowed for a month field:
<!DOCTYPE html> <html> <body> Month:/*from w ww.ja v a 2 s . co m*/ <input type="month" id="myMonth" min="2018-04" max="2018-09"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myMonth").max; document.getElementById("demo").innerHTML = x; } </script> </body> </html>