Javascript examples for DOM HTML Element:Input Date
Input Date required Property - Set a date field to be a required part of form submission:
<!DOCTYPE html> <html> <body> <form action="#"> Date: <input type="date" id="myDate" name="date"> <input type="submit"> </form>/* w w w .jav a 2s. co m*/ <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("myDate").required = true; document.getElementById("demo").innerHTML = "The date field must now be filled before submitting the form."; } </script> </body> </html>