如何设置max&在iOS上输入类型日期的最小值

时间:2015-12-22 20:22:24

标签: javascript html ios html5

如何在输入类型日期

中设置最小和最大日期

我试试

<input name="DOB" id="DOB" class="enterAddressFormField" placeholder="Date of birthday&nbsp;" 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&nbsp;" 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();">

1 个答案:

答案 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/

jQuery DatePicker Min Max dates