I have a select box where the user can pick 3 different shops. It shouldn\'t be possible to pick weekends for shop 2 and 3, and for shop 1 you should only be able to pick Mo
See this: DEMO
function loadDatePicker(setting) {
$("#datepicker").datepicker("destroy");
if(setting == 'noWeekends') {
$( "#datepicker" ).datepicker({ beforeShowDay: $.datepicker.noWeekends, minDate: +2, maxDate: "+1M" });
}
else if(setting == 'noSunday') {
$( "#datepicker" ).datepicker({ beforeShowDay: noSunday, minDate: +2, maxDate: "+1M" });
}
$( "#datepicker" ).datepicker("refresh");
}
You need to put $("#datepicker").datepicker("destroy");
each time before changing settings...
$("#datepicker").datepicker("destroy");
Above line work for clearing the datepicker
.
$("#datepicker").datepicker("destroy");