【问题标题】:Jquery Datepicker remove days of previous or next month from the current monthJquery Datepicker 从当前月份中删除上个月或下个月的日期
【发布时间】:2015-11-08 16:19:18
【问题描述】:

我想从当前观看月份中删除上个月或下个月的几天,以便您准确理解我的意思我将附上屏幕截图,其中我突出显示了我需要删除的内容

我试过这段代码

$('.ui-state-disabled').html('').closest('td').removeClass('highlight-date');
$(document).on('click', '.ui-datepicker-next', function(event) {
    $('.ui-state-disabled').html('').closest('td').removeClass('highlight-date');
});
$(document).on('click', '.ui-datepicker-prev', function(event) {
    $('.ui-state-disabled').html('').closest('td').removeClass('highlight-date');
}); //removes all days of previos month from the current month

它会删除那些日子,但是当我点击它重新出现的日子时

这段代码

$('.ui-state-disabled').html('').closest('td').removeClass('highlight-date');

在 onSelect 或 beforeShowDay 等日期选择器设置中不起作用:

有什么办法,我真的需要去掉天数

【问题讨论】:

    标签: javascript jquery jquery-ui datepicker


    【解决方案1】:

    默认情况下它们是关闭的。 您将这些属性添加到您的日期选择器以显示它们:

    showOtherMonths: true,
    selectOtherMonths: true
    

    https://jqueryui.com/datepicker/#other-months

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-29
      相关资源
      最近更新 更多