PDA

View Full Version : jQuery UI Datepicker Default date of second calendar depending on first



kimmi_baby
02-18-2012, 04:05 AM
Hi,
I have 2 calendars using jquery UI datepicker. The first calendar is default to todays date. What I need to happen is for the second calendar default date to change to default date (of first calendar) + 1 day. I'm really not too sure how to do this... So any help would be great!

This is the code I have so far:

[CODE]

$(document).ready(function(){
$("#startDate").datepicker({
dateFormat: "dd/mm/yy" }).val()
$('#startDate').datepicker('setDate', new Date());

});

$(document).ready(function(){
$("#endDate").datepicker({
dateFormat: "dd/mm/yy" }).val()

});

$('#startDate').datepicker({onSelect: function(dateStr) {
$('#endDate').datepicker('option', 'defaultDate', dateStr);
}});
$('#endDate').datepicker();
[/ICODE]