Jquery Date picker Default Date

MACMAN picture MACMAN · Jul 11, 2011 · Viewed 207.8k times · Source

I am using a Jquery Datepicker in my project. The problem is that it is not loading the current date, but showing a date 1st January 2001 as default. Can you please let me know how the default date can be corrected so it will display the current date.

Answer

ghayes picture ghayes · Jul 11, 2011

Use the defaultDate option

$( ".selector" ).datepicker({ defaultDate: '01/01/01' });

If you change your date format, make sure to change the input into defaultDate (e.g. '01-01-2001')