[英]jQuery Datepicker UI Tooltip
Is it possible to add tooltip only to the disabled dates in jQuery datepicker? 是否可以将工具提示仅添加到jQuery datepicker中的禁用日期?
$(function() {
$('#datepicker').datepicker({
minDate : 0,
maxDate : +30,
beforeShowDay: function(date) {
return [true, 'highlight', 'The custom title'];
}
});
});
My code puts the tooltip to all dates. 我的代码将工具提示放到所有日期。
Yes. 是。 It is possible.
有可能的。 Check the below link to know more on disabling date.
检查以下链接以了解更多有关禁用日期的信息。
http://api.jqueryui.com/datepicker/#option-beforeShowDay http://api.jqueryui.com/datepicker/#option-beforeShowDay
Below is the code 下面是代码
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 });
Demo : https://jsfiddle.net/j2caztgu/ 演示: https : //jsfiddle.net/j2caztgu/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.