+ 1
How to get value from input type date?
2 Answers
+ 2
Hi Harshit
Your HTML
<form>
Birthday:
<input id="datePicker" type="date" name="bday">
</form>
Your JS
window.onload=function(){
document.getElementById("datePicker").addEventListener("change", function() {
var input = this.value;
var dateEntered = new Date(input);
console.log(input); //e.g. 2015-11-13
console.log(dateEntered); //e.g. Fri Nov 13 2015 00:00:00 GMT+0000 (GMT Standard Time)
});
0
Thanks Sir!