Set a month field to be a required part of form submission:
document.getElementById("myMonth").required = true;
Click the "Test" button to set the required property for the month field.
input elements with type=month is not supported in Firefox.</p>
<!DOCTYPE html> <html> <body> <form action="/action_page.php"> Month: <input type="month" id="myMonth" name="bdaymonth"> <input type="submit"> </form>/* ww w. j a v a2s. c om*/ <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("myMonth").required = true; document.getElementById("demo").innerHTML = "The required property was set. "; } </script> </body> </html>