How do i disable public holidays in a jQuery UI date picker?

泪湿孤枕 提交于 2019-12-03 03:40:40

you can exclude the dates like

var holidays = ["2014-02-27","2014-02-01"];
$( "#from" ).datepicker({
beforeShowDay: function(date){
    var datestring = jQuery.datepicker.formatDate('yy-mm-dd', date);
    return [ holidays.indexOf(datestring) == -1 ]
}
});

you can provide more dates to the holidays array

You have to use beforeShowDay attribute of DatePicker like below:

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

Above script will disable all Sundays.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!