【问题标题】:Disable jquery dates on change of month?更改月份时禁用jquery日期?
【发布时间】:2016-05-16 09:06:23
【问题描述】:

我们如何在月份更改时禁用 jquery datepicker 日期。 我目前正在使用 beforeShowDay 功能禁用它。

beforeShowDay:  function(date){     

            var string = jQuery.datepicker.formatDate('yy-mm-dd', date);
            return [ unavailableDates.indexOf(string) == -1 ]
}

现在我想禁用用户点击下个月的日期.. 有什么想法吗?

【问题讨论】:

标签: jquery jquerydatetimepicker


【解决方案1】:
The following example disables dates 14 March 2013 thru 16 March 2013.
    var array = ["2013-03-14","2013-03-15","2013-03-16"]
$('input').datepicker({
    beforeShowDay: function(date){
        var string = jQuery.datepicker.formatDate('yy-mm-dd', date);
        return [ array.indexOf(string) == -1 ]
    }
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-23
    相关资源
    最近更新 更多