Highlight dates in specific range with jQuery's datepicker
date, datepicker, highlight, jquery
Solution
You can use the beforeShowDay event. It will get called for each date that needs to be shown in the calendar. It passes in a date and return an array with `[0]= isSelectable, [1]= cssClass, [2]=Some tooltip text`
$('#whatever').datepicker({
beforeShowDay: function(date) {
if (date == myDate) {
return [true, 'css-class-to-highlight', 'tooltipText'];
}else{
//this will allow the cell be selected without been highlighted
return [true,'']
}
}
});
Problem
I need to highlight the dates between a start date and an end date, which I should be able to specify. Can anyone help me?