How do I pre-populate a jQuery Datepicker textbox with today’s date?

I have a very simple jQuery Datepicker calendar:

$(document).ready(function(){
    $("#date_pretty").datepicker({ 
    });
});

and of course in the HTML…

<input type="text" size="10" value="" id="date_pretty"/>

Today’s date is nicely highlighted for the user when they bring up the calendar, but how do I get jQuery to pre-populate the textbox itself with today’s date on page load, without the user doing anything? 99% of the time, the today’s date default will be what they want.

19 Answers
19

Leave a Comment