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

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

问题描述

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

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.

不好的解决方法

beforeShowDay 将 true 或 false 作为每天的参数.所以写一个函数,根据每一天返回 true 或 false.

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

推荐答案

试试这个

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

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

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