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