在jQuery datepicker中突出显示一周中的特定日子 [英] Highlight specific days of a week in jQuery datepicker
本文介绍了在jQuery datepicker中突出显示一周中的特定日子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的目的是在jQuery datepicker中突出显示一周中的特定日期.
my aim is to highlight specific days of a week in jQuery datepicker.
例如,我要突出显示星期二和星期四.我看过很多示例,这些示例如何突出显示特定日期(请参阅: http://jquerybyexample.blogspot.com/2012/05/highlight-specific-dates-in-jquery-ui.html ).但没有一个可以满足我的需求.
For example I want to highlight Tuesdays and Thursdays. I've seen many examples how to highlight specific dates(see: http://jquerybyexample.blogspot.com/2012/05/highlight-specific-dates-in-jquery-ui.html). But not a single one that covers my needs.
有任何提示吗?
推荐答案
您可以调整链接的示例,以执行所需的操作,如下所示:
You could adapt the example you linked, to do what you want, like this:
CSS:
.Highlighted a{
background-color : Green !important;
background-image :none !important;
color: White !important;
font-weight:bold !important;
font-size: 12pt;
}
JavaScript:
Javascript:
$(document).ready(function() {
$('#datepicker').datepicker({
beforeShowDay: function(date) {
var day = date.getDay();
if (day == 2 || day == 4) {
return [true, "Highlighted", date];
}
return [true, '', ''];
}
});
});
应该这样做.
这篇关于在jQuery datepicker中突出显示一周中的特定日子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文