Set initial value in datepicker with jquery?

This simple example works for me…

HTML

<input type="text" id="datepicker">

JavaScript

var $datepicker = $('#datepicker');
$datepicker.datepicker();
$datepicker.datepicker('setDate', new Date());

I was able to create this by simply looking @ the manual and reading the explanation of setDate:

.datepicker( “setDate” , date )
Sets the current date for the datepicker. The new date may be a Date
object or a string in the current date format (e.g. ’01/26/2009′), a
number of days from today (e.g. +7) or a string of values and periods
(‘y’ for years, ‘m’ for months, ‘w’ for weeks, ‘d’ for days, e.g. ‘+1m
+7d’), or null to clear the selected date.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)