Javascript examples for DOM HTML Element:Input Month
The Input Month object represents an HTML <input> element with type="month".
You can access an <input> element with type="month" by using getElementById():
<!DOCTYPE html> <html> <body> <input type="month" id="myMonth" value="2014-05"> <button onclick="myFunction()">get the month and year of the month field</button> <p id="demo"></p> <script> function myFunction() {// w ww . jav a 2s. c om var x = document.getElementById("myMonth").value; document.getElementById("demo").innerHTML = x; } </script> </body> </html>