jQuery的日期驗證,同時明確地輸入該輸入字段,而不是從日期選擇器jQuery的日期驗證,而在輸入欄下明確鍵入
選擇我只想最小日期爲今天。即我不想選擇未來的日期。
在日期選擇器中,我禁用了未來日期。但是,當我在字段中輸入日期時,它接受未來日期。
這裏是我的jQuery代碼
jQuery(document).ready(function() {
jQuery("#datepicker").datepicker({ maxDate: new Date(),dateFormat: 'MM/DD/YYYY' });
jQuery('.fa-calendar').click(function() {
jQuery("#datepicker").focus();
});
});
爲什麼你不加'只讀= 「」'上輸入字段?因此,該用戶不會允許輸入日期..他只需要從datepicker中選擇 – Mufi
您是否嘗試過使用'maxDate:0'? – Diego
嘿,馬蒂結帳我的答案。那是你要的嗎? –