如何在输入类型日期
中设置最小和最大日期我试试
<input name="DOB" id="DOB" class="enterAddressFormField" placeholder="Date of birthday " size="50" maxlength="60" pattern="yyyy-MM-dd" type="text" onfocus="this.type='date';this.max=='1979-12-31';this.min=='1910-01-01';this.setAttribute('onfocus','');this.blur();this.focus();">
和
<input name="DOB" id="DOB" class="enterAddressFormField" placeholder="Date of birthday " size="50" maxlength="60" pattern="yyyy-MM-dd" min="1910-01-02" max="1979-12-31" type="text" onfocus="this.type='date';this.setAttribute('onfocus','');this.blur();this.focus();">
答案 0 :(得分:0)
您应该使用datepicker js
$('#datepicker').datepicker({
dateFormat: "yy-mm-dd",
maxDate:'+1m +10d',
minDate: -10
});
在这里查看
https://makitweb.com/set-minimum-maximum-date-jquery-ui-datepicker/