如何在boostrap嵌入/内联日期选择器上突出显示特定日期?
我试过了:
$(document).ready(function () {
$('#datepicker').datepicker({
format: "dd/mm/yyyy",
minDate:new Date(),
startDate: "now"
});
});
HTML:
<div id="datepicker"></div>
答案 0 :(得分:0)
您可以使用beforeShowDay
突出显示特定日期,如下所示。
var active_dates = ["16/6/2017"]; // Highlite date
$('#datepicker').datepicker({
beforeShowDay: function(date) {
var d = date;
var curr_date = d.getDate();
var curr_month = d.getMonth() + 1; //Months are zero based
var curr_year = d.getFullYear();
var formattedDate = curr_date + "/" + curr_month + "/" + curr_year;
if ($.inArray(formattedDate, active_dates) != -1) {
return {
classes: 'highlight'
};
}
return;
}
});