Javascript examples for DOM HTML Element:Input Datetime
Input Datetime required Property - Set a datetime field to be a required part of form submission:
<!DOCTYPE html> <html> <body> <form action="#"> Date: <input type="datetime" id="myDatetime" name="date"> <input type="submit"> </form>/*from w ww. j a v a 2 s. c om*/ <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("myDatetime").required = true; document.getElementById("demo").innerHTML = "required"; } </script> </body> </html>