JQuery ui - date picker, disabling specific dates
It looks like you're calling datepicker
twice on one input. Its kind of hard to follow your code, but if you re-organize it and remove the second datepicker
call, everything should work:
<script type="text/javascript">
var unavailableDates = ["9-3-2012", "14-3-2012", "15-3-2012"];
function unavailable(date) {
dmy = date.getDate() + "-" + (date.getMonth() + 1) + "-" + date.getFullYear();
if ($.inArray(dmy, unavailableDates) == -1) {
return [true, ""];
} else {
return [false, "", "Unavailable"];
}
}
$(function() {
$("#iDate").datepicker({
dateFormat: 'dd MM yy',
beforeShowDay: unavailable
});
});
</script>
Check this article: disable-dates-in-datepicker