开发者

Disable list of holidays in Jquery date picker

开发者_开发知识库

How to disable a list of holidays using jquery date picker?


var disabledDates = ['08/30/2010', '05/30/2010', '02/14/2011']; 

function noWeekendsOrHolidays(date) { 
        var noWeekend = $.datepicker.noWeekends(date); 
        if (noWeekend[0]) { 
            return disableDays(date); 
        } else { 
            return noWeekend; 
        } 
} 

function disableDays(date) { 
    for (var i = 0; i < disabledDates.length; i++) { 
        if (new Date(disabledDates[i]).toString() == date.toString()) {              
            return [false]; 
        } 
    } 
    return [true]; 
}  

$(.selector).datepicker({minDate: new Date(),beforeShowDay: noWeekendsOrHolidays, changeYear: true ,changeMonth: true});   
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜