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