Javascript examples for DOM HTML Element:Input Date
Pre-populating date input field
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=( function() {/*from www. java 2 s . co m*/ (function () { var date = new Date().toISOString().substring(0, 10), field = document.querySelector('#date'); field.value = date; console.log(field.value); })(); }); </script> </head> <body> <input id="date" type="date" value="2019-11-11"> </body> </html>