<input id="datePicker" type="date" />
i will set today date in datepicker input type date in chrome.
$(document).ready( function() {
var now = new Date();
var today = now.getDate() + '/' + (now.getMonth() + 1) + '/' + now.getFullYear();
alert(today);
$('#datePicker').val(today);
});
but it's not working
Edit This jsFiddle - Please try in chrome.
Fiddle link : http://jsfiddle.net/7LXPq/93/
Two problems in this:
Please follow the fiddle link for demo:
var now = new Date();
var day = ("0" + now.getDate()).slice(-2);
var month = ("0" + (now.getMonth() + 1)).slice(-2);
var today = now.getFullYear()+"-"+(month)+"-"+(day) ;
$('#datePicker').val(today);