這是一個花店,當一個客戶填寫表格時,他們必須選擇一個日期(jquery datepicker)和交貨時間(選擇字段)。星期六有不同的交貨時間從太陽 - 星期五。我創建了兩個不同的發貨時間字段,並希望隱藏星期六,除非客戶在日期選擇器上選擇星期六。如何在jquery datepicker中選擇星期六時隱藏元素並顯示另一個元素?
這是我迄今爲止..
$('.mydatepicker').datepicker(function() {
if ($(day == 6)) {
$('#delivery_time_normal').hide();
} else {
$('#delivery_time_saturday').show();
}
});
您需要使用在該日期選擇器記錄的事件API。你使用哪種日期選擇器......有很多呢? – charlietfl
jQuery UI日期選擇器:https://jqueryui.com/datepicker/ – epochcoding