理想情況下,日期陣列將檢查我的谷歌日歷的日期,我想在我的日歷中阻止這些日期
。<script> $(document) 。 ready(function(){
var dates = ["06-08-2021"/span>]。
function DisableDates(date){
var string = jQuery.datepicker.formatDate('mm-dd-yy', date) 。
return [dates.indexOf(string) == -1] 。
}
$("#datepicker").datepicker({
dateFormat: 'mm-dd-yy'。
beforeShowDay: $.datepicker.noWeekends。
beforeShowDay: DisableDates。
});
})
</script>
uj5u.com熱心網友回復:
這樣做可以:
var dates = ["06-08-2021"/span>];
function DisableDates(date) {
var noWeekend = $.datepicker.noWeekends(date)。
if (noWeekend[0] ) {
var string = jQuery.datepicker.formatDate('mm-dd-yy', date) 。
return [dates.indexOf(string) == -1] 。
} else {
return noWeekend。
}
}
$("#datepicker").datepicker({
dateFormat: 'mm-dd-yy'。
beforeShowDay: DisableDates。
});
<link href="http://code. jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="styleheet" />
<script src="https://cdnjs. cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>/span>
<script src="https://code. jquery.com/ui/1.12.1/jquery-ui.js"></script>
<p>/span>日期。<input type="text" id="Datepicker"> </p>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" class="snippet-box-edit snippet-box-result" frameborder="0"></iframe>
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/319940.html
標籤:
