set input type to date javascript code example Example: set date input html using js document.getElementById("datePicker").valueAsDate = new Date()