Using "date range" datepicker with "live"
I need to implement a version of
this official date range datepicker example to work on a page that is loaded via AJAX. I assume I need to squeeze a "live" in there somewhere...
Here's what I have so far. It almost works, except for the fact that it doesn't restrict the "#DueDate" when I select a "#StartDate".
- $().ready(function() {
var dates = $('#StartDate, #DueDate').live('click', function() {
$(this).datepicker({
defaultDate: '+1w',
changeMonth: false,
numberOfMonths: 3,
onSelect: function(selectedDate) {
var option = this.id == 'StartDate' ? 'minDate' : 'maxDate',
instance = $(this).data('datepicker'),
date = $.datepicker.parseDate(instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings);
dates.not(this).datepicker('option', option, date);
}
}).focus();
});
});
Anyone have any advice? Thanks in advance.