You can use the beforeShowDay
event, it fits your needs. It allows you to return:
A function that takes a date as a parameter and must return an array with:
- [ 0]: true/false indicating whether or not this date is selectable
- [ 1]: a CSS class name to add to the date's cell or "" for the default presentation
- [ 2]: an optional popup tooltip for this date The function is called for each day in the datepicker before it is displayed.
In this case is not used the jQuery UI tooltip plugin, but a "regular" tooltip.
Code:
var disabledTool = new Date();
disabledTool.setDate(disabledTool.getDate() - 2);
disabledTool.setHours(0, 0, 0, 0);
$(function () {
$("#datepicker").datepicker({
minDate: -0,
maxDate: "+1M +2D",
showOn: "button",
dateFormat: 'D dd MM yy',
showAnim: "clip",
beforeShowDay: function (date) {
var tooltipDate = "I'm DISABLED!!";
if (date.getTime() == disabledTool.getTime()) {
return [true, '', tooltipDate];
} else {
return [true, '', ''];
}
}
});
});