在jQuery UI日历中禁用所有星期日

时间:2021-12-31 20:36:04

I want to disable Sundays in jQuery UI calendar.

我想在jQuery UI日历中禁用星期日。

From docs I came to know about this:--

从我开始了解的文档: -

$('#datepicker').datepicker({ minDate: 4,beforeShowDay: $.datepicker.noWeekends }); 

This will disable Saturdays and Sundays both. But I want to diasble only Sunday. Is there any default option for this.

这将禁用星期六和星期日。但是我想在星期天才能解决问题。是否有任何默认选项。

Bad way to solve it

解决它的坏方法

beforeShowDay take true or false as params for every day. So write a function which returns true or false based upon each day.

beforeShowDay作为每天的参数使用true或false。因此,编写一个基于每一天返回true或false的函数。

1 个解决方案

#1


50  

try this

尝试这个

$("#datepicker").datepicker({
    beforeShowDay: function(date) {
        var day = date.getDay();
        return [(day != 0), ''];
    }
});

#1


50  

try this

尝试这个

$("#datepicker").datepicker({
    beforeShowDay: function(date) {
        var day = date.getDay();
        return [(day != 0), ''];
    }
});