Reputation: 2508
i would like have a certain dates in my jquery to be disabled or perhaps unclickable but with a different class. So far what i got is this which only disables the date but i can't seem to add a class to it.
var unavailableDates = ["9-7-2016"];
function unavailable(date) {
dmy = date.getDate() + "-" + (date.getMonth() + 1) + "-" + date.getFullYear();
if ($.inArray(dmy, unavailableDates) == -1) {
return [true, ""];
} else {
return [false, "", "Unavailable"];
}
}
var dateToday = new Date();
$("#iDate").multiDatesPicker({
defaultDate: new Date(),
dateFormat: 'dd MM yy',
beforeShowDay: unavailable,
minDate: dateToday
});
I found this while doing some searching which is very close to what i want http://jsfiddle.net/ambiguous/pjJGf/
but i don't know how to make it so that it calls the dates instead of fixed day of the month.
Upvotes: 0
Views: 136
Reputation: 207901
The beforeShowDay
function must return an array with two elements (an an optional third). The second array element is the name of the class you want to return for a day. So modify the return statement in the else part of your if condition to return [false, "name-of-css-class", "Unavailable"];
Upvotes: 1