0
我在表單中包含了bootstrap datepicker。 beforeShowDay()僅在第一次點擊日期或上一個月箭頭(>>)後才起作用。你能幫我一把,因爲它可以自己打開。BootShow datepicker beforeShowDay只能在第一次點擊後才起作用
這是我試過的代碼。
$(document).ready(function(){
$('#ReportFromDate').datepicker({
autoclose:true,
endDate: new Date(),
format: "mm/dd/yyyy",
language : 'pt-BR'
});
$('#ReportToDate').datepicker({
autoclose:true,
beforeShowDay: function (date) {
var endDate1 = new Date();
var startDate1 = new Date($('#ReportFromDate').val());
console.log("new "+ startDate1 +" "+endDate1);
if (date.valueOf() <= endDate1.valueOf() && date.valueOf() >= startDate1.valueOf()) {
return (date.valueOf() <= endDate1.valueOf() && date.valueOf() >= startDate1.valueOf());
} else {
return false;
}
},
format: "mm/dd/yyyy"
});
});
我使用這個https://bootstrap-datepicker.readthedocs.org/en/release/ – 2015-02-07 06:40:05