jQuery UI Datepicker是否可以禁用周末和节假日? [英] jQuery UI Datepicker be made to disable weekends and holidays?
本文介绍了jQuery UI Datepicker是否可以禁用周末和节假日?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我看到了一个确切的问题正在回答,但是问题是,我绝对不知道将代码粘贴到哪里
I have seen an exact question being answered, but the problem is, I have absolutely no idea where to paste the codes shown here for mine to work. I am really a noob when it comes to programming.
如果有人急切地希望我的日历能工作,那么如果有人乐于启发我,我将不胜感激. :(
Would appreciate if someone would be so kind to enlighten me as I desperately need to get my calendar working. :(
非常感谢您.
推荐答案
var holidays= ["2014-7-30","2015-07-29","2013-03-16"]
$('input').datepicker({
beforeShowDay: function(date){
var string = jQuery.datepicker.formatDate('yy-mm-dd', date);
var noWeekend = $.datepicker.noWeekends(date);
if (noWeekend[0]) {
return [$.inArray(string, holidays) == -1];
}
else
return noWeekend;
}
});
这篇关于jQuery UI Datepicker是否可以禁用周末和节假日?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文