Highlight dates in specific range with jQuery’s datepicker

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,'']
              }
           }
});

Leave a Comment