我在我的一个项目中使用JQuery UI日期选择器。我需要禁用美国假期日期。我试过jQuery UI Datepicker - Disable specific days和Can the jQuery UI Datepicker be made to disable Saturdays and Sundays (and holidays)?JQuery UI:日期选择器
但他们没有工作。我怎样才能让特殊的日子变得不可选择。
我也试过用http://tokenposts.blogspot.com/2011/05/jquery-datepicker-disable-specific.html,代码片段正在运行appart,但不是在我的项目中。这就是:
var unavailableDates = ["31-12-2012"];
function unavailable(date) {
dmy = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear();
if ($.inArray(dmy, unavailableDates) == -1) {
return [true, ""];
} else {
return [false,"","Unavailable"];
}
}
Drupal.behaviors.date_popup = function (context) {
for (var id in Drupal.settings.datePopup) {
$('#'+ id).bind('focus', Drupal.settings.datePopup[id], function(e) {
if (!$(this).hasClass('date-popup-init')) {
var datePopup = e.data;
// Explicitely filter the methods we accept.
switch (datePopup.func) {
case 'datepicker':
$(this)
.datepicker({ minDate: +1, maxDate: "+3Y", beforeShow: unavailable })
.addClass('date-popup-init')
$(this).click(function(){
$(this).focus();
});
break;
case 'timeEntry':
$(this)
.timeEntry(datePopup.settings)
.addClass('date-popup-init')
$(this).click(function(){
$(this).focus();
});
break;
}
}
});
}
};
如果他们工作了谁张贴问题的任择议定书,我不明白为什么它不会为你...除非你告诉我们,你的代码试图告诉我们什么** **没有按't工作 – JMax 2011-12-29 10:34:01
我已经张贴 – orif 2011-12-29 11:02:12