I'm using this jQuery inline datePicker plugin sample but I don't know how to set up default date selected. Do you have any idea?
+1
A:
Here: http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePickerDefaultToday.html
$(function() {
var date = new Date(); // replace with your date
$('.date-pick').datePicker().val(date.asString()).trigger('change');
});
OR
Set date in your field:
<input class="date-pick" type="text" value="1/1/2009" />
Koistya Navin
2009-04-05 08:54:58
this is possible when the datepicker is linked to a input, but my inline datepicker is linked to a div.:( I still don't know how to do it.
dole doug
2009-04-05 09:02:02
ok, than use the first approach with .val('1/1/2009').trigger('change');
Koistya Navin
2009-04-05 16:09:25
you cannot assign a value attribute to a div tab!
dole doug
2009-04-06 13:54:39
+3
A:
$('.date-pick').datePicker({ defaultDate: $.datepicker.parseDate("d m y", "31 8 2009") })
Philippe Rathé
2009-08-31 21:37:42
It also seems to accept simple strings and interpret them intelligently. For example, this sets the default date to 2 months in the past: `... defaultDate: "-2m" ...` however, it doesn't seem to actually *select* the date. It just makes sure to display that date's month when the calendar popup appears.
Dan
2010-05-24 15:15:48