更新时间:2023-01-29 20:22:07
您可以使用 在ShowDay 事件之前.它将为需要在日历中显示的每个日期调用.它传入一个日期并返回一个带有 [0]= isSelectable, [1]= cssClass, [2]=Some tooltip text
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,'']
}
}
});