I just want today's date to be the default value in the input that is using jQuery UI's datepicker
:
<input id="mydate" type="text" />
I tried the below code but it didn't work:
var currentDate = new Date();
$("#mydate").datepicker("setDate",currentDate);
You need to make the call to setDate separately from the initialization call. So to create the datepicker and set the date in one go:
$("#mydate").datepicker().datepicker("setDate", new Date());
Why it is like this I do not know. If anyone did, that would be interesting information.