我正在度假預訂應用程序,很明顯,你不需要預定掉那些已經提供給您的假期,所以我每年都需要知道如何禁用,聖誕,例如從日期選取器沒有我每年都必須更改代碼。如何禁用jQuery UI日期選擇器中的公共節假日?
這是我的jQuery UI的日期選擇器代碼至今:
<script>
$(function() {
$("#from").datepicker({
beforeShowDay: $.datepicker.noWeekends,
defaultDate: "today",
changeMonth: true,
numberOfMonths: 1,
minDate: "today",
dateFormat: "dd/mm/yy",
onClose: function(selectedDate) {
$("#to").datepicker("option", "minDate", selectedDate);
}
});
$("#to").datepicker({
beforeShowDay: $.datepicker.noWeekends,
defaultDate: "today",
changeMonth: true,
numberOfMonths: 1,
minDate: "today",
dateFormat: "dd/mm/yy",
onClose: function(selectedDate) {
$("#from").datepicker("option", "maxDate", selectedDate);
}
});
});
</script>
這應該有幫助... http://davidwalsh.name/jquery-datepicker-disable-days – Archer
重複http://stackoverflow.com/questions/677976/jquery-ui-datepicker-disable-specific-days – monu