Highlight dates in specific range with jQuery's datepicker

后端 未结 7 1466
余生分开走
余生分开走 2020-11-27 19:06

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?

7条回答
  •  情话喂你
    2020-11-27 19:44

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

提交回复
热议问题