是否可以仅向 jQuery 日期选择器中禁用的日期添加工具提示?
$(function() {
$('#datepicker').datepicker({
minDate : 0,
maxDate : +30,
beforeShowDay: function(date) {
return [true, 'highlight', 'The custom title'];
}
});
});
我的代码将工具提示置于所有日期。
最佳答案
是的。有可能的。检查下面的链接以了解有关禁用日期的更多信息。
http://api.jqueryui.com/datepicker/#option-beforeShowDay
下面是代码
var disabledDates = ["11-2-2016","19-2-2016","28-2-2016"];
function disableDate(date) {
dmy = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear();
if ($.inArray(dmy, disabledDates) < 0) {
return [true,"",""];
} else {
return [false,"","This is disabled"];
}
}
$('.datePicker').datepicker({ beforeShowDay: disableDate });
关于javascript - jQuery 日期选择器 UI 工具提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35232903/