Javascript examples for DOM HTML Element:Input Month
The min property sets or gets the min attribute of a month field, which controls the minimum month and year for a month field.
Set the min property with the following Values
Value | Description |
---|---|
YYYY-MM | Sets the minimum month and year allowed. |
A String, representing the minimum month and year allowed
The following code shows how to get the minimum month and year allowed for a month field:
<!DOCTYPE html> <html> <body> Month:/*from w w w.ja v a 2 s . c o 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").min; document.getElementById("demo").innerHTML = v; } </script> </body> </html>