Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
禁用jQuery UI日期选择器_Jquery_Jquery Ui_Datepicker - Fatal编程技术网

禁用jQuery UI日期选择器

禁用jQuery UI日期选择器,jquery,jquery-ui,datepicker,Jquery,Jquery Ui,Datepicker,我想能够禁用每年发生的一些银行假日,例如圣诞节,但我也希望能够禁用仅发生一年的日子 这是我的代码,我已经有了 var unavailableDates = ["25-12", "26-12", "1-1"]; function unavailable(date) { dmy = date.getDate() + "-" + (date.getMonth() + 1); if ($.inArray(dmy, unavailableDates) == -

我想能够禁用每年发生的一些银行假日,例如圣诞节,但我也希望能够禁用仅发生一年的日子

这是我的代码,我已经有了

  var unavailableDates = ["25-12", "26-12", "1-1"];

    function unavailable(date) {
        dmy = date.getDate() + "-" + (date.getMonth() + 1);
        if ($.inArray(dmy, unavailableDates) == -1) {
            return [true, ""];
        } else {
            return [false, "", "Unavailable"];
        }
    }


    function noWeekendsOrHolidays(date) {
        var noWeekend = jQuery.datepicker.noWeekends(date);
        return noWeekend[0] ? unavailable(date) : noWeekend;
    }
有人知道怎么做吗?

这样称呼:

$(".selector").datepicker({ beforeShowDay: noWeekendsOrHolidays})   
jQueryUIDatePicker的api

beforeShowDay    Type: Function( Date date )

Default: null
A function that takes a date as a parameter and must return an array with:
[0]: true/false indicating whether or not this date is selectable
[1]: a CSS class name to add to the date's cell or "" for the default presentation
[2]: an optional popup tooltip for this date
The function is called for each day in the datepicker before it is displayed. 

这可能会有所帮助