【发布时间】:2016-07-05 14:17:04
【问题描述】:
我有一个用于 web 应用程序的 Jquery 日期选择器,我的问题是:我想在需要时同时突出显示 2 天。这仅适用于周末
当我选择星期六时,星期天必须突出显示(添加一个名为“ui-native-asive”)的类,对于星期日,周日选择时,星期六也必须突出显示。
beforeShowDay: function(d) {
var selecteddate = $( ".datepicker" ).datepicker( "getDate" );
var day = selecteddate.getDay();
if (day == 6) { // day 6 = saturday
// Now saturday must get the class highlight
return [true, 'highlight'];
}
else if (day == 0){ // day 0 = sunday
// Now sunday must get the class highlight
return[true, 'highlight'];
}
}
问候 丹尼斯
【问题讨论】:
-
您尝试过什么吗?您当前的代码是什么?
-
@JacquesMarais I've searched for the internet and tried the example above I posted, but I can't trigger the other day when one day is selected and can't find anything in common of this.
-
“突出显示”是什么意思?是否也要将值设置为第二天?
-
@JacquesMarais yep, when one day is selected, it has the class "ui-state-active", so then I want that class too on the Saturday or Sunday, based on the selected day.
-
请编辑您的帖子以包含该信息
标签: javascript jquery datepicker