How do I pre-populate a jQuery Datepicker textbox with today's date?
Update: There are reports this no longer works in Chrome.
This is concise and does the job (obsolete):
$(".date-pick").datepicker('setDate', new Date());
This is less concise, utilizing chaining allows it to work in chrome (2019-06-04):
$(".date-pick").datepicker().datepicker('setDate', new Date());
You must FIRST call datepicker() > then use 'setDate' to get the current date.
$(".date-pick").datepicker();
$(".date-pick").datepicker("setDate", new Date());
OR chain your setDate method call after your datepicker initialization, as noted in a comment on this answer
$('.date-pick').datepicker({ /* optional option parameters... */ })
.datepicker("setDate", new Date());
It will NOT work with just
$(".date-pick").datepicker("setDate", new Date());
NOTE : Acceptable setDate parameters are described here
var myDate = new Date();
var prettyDate =(myDate.getMonth()+1) + '/' + myDate.getDate() + '/' +
myDate.getFullYear();
$("#date_pretty").val(prettyDate);
seemed to work, but there might be a better way out there..