- var dates = $('#form_1,#to_1').datepicker({
- (....other options...)
- onSelect: function( selectedDate ) {
- var option = this.id == "from_1" ? "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 );
-
- }
-
- });
I'm looking to chain #from_2 to restrict dates prior to #to_1, #to_2 to restrict dates prior to #from_2, etc. I've been struggling with this for a few days. I can create sets of similar scripts, but that seems v. wasteful. php will allow their creation via a loop, but as I say, this seems wasteful. Anybody got a clue?