使用 jQuery 的日期选择器突出显示特定范围内的日期 [英] Highlight dates in specific range with jQuery's datepicker

查看:21
本文介绍了使用 jQuery 的日期选择器突出显示特定范围内的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要突出显示开始日期和结束日期之间的日期,我应该能够指定这些日期.谁能帮我?

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?

推荐答案

您可以使用 在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,'']
              }
           }
});

这篇关于使用 jQuery 的日期选择器突出显示特定范围内的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆