禁用jQuery UI日历中的所有星期天 [英] Disable all Sundays in jQuery UI Calendar

查看:104
本文介绍了禁用jQuery UI日历中的所有星期天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



从文档我来了解: -



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

这将禁用星期六和星期日。但是我只想在星期天放弃。是否有任何默认选项。



解决问题的方法



beforeShowDay每天都以真实或虚假为参数。所以写一个函数,它基于每一天返回true或false。

解决方案

尝试这个

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


I want to disable Sundays in jQuery UI calendar.

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.

解决方案

try this

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

这篇关于禁用jQuery UI日历中的所有星期天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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