Monday, October 5, 2009

Connect Jquery Datepicker Objects

Here's a script that binds / connects a jquery datepicker (Kelvin Luck's jquery datepicker plugin: http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/) instance to another one. This is helpful if the dates in your form need to follow greater/less than rules.

The script sets the start date of child datepicker to the date selected in the HistoryEnabled datepicker -


Date.format = 'mm/dd/yyyy';
$('.date-pick').datePicker({ clickInput: true });
$('.date-pickHistoryEnabled')
.datePicker(
{
clickInput: true,
startDate: '01/01/1996'
})
.bind("change", function() {$('.date-pick').datePicker({ startDate: $(this).val() })});

No comments:

Post a Comment