HTML input min property
Examples
min and max attributes to use:
<form action="demo-form.php">
输入 1980-01-01 之前的日期:
<input type="date" name="bday" max="1979-12-31"><br>
输入 2000-01-01 之后的日期:
<input type="date" name="bday" min="2000-01-02"><br>
数量 (在1和5之间):
<input type="number" name="quantity" min="1" max="5"><br>
<input type="submit">
</form>
输入 1980-01-01 之前的日期:
<input type="date" name="bday" max="1979-12-31"><br>
输入 2000-01-01 之后的日期:
<input type="date" name="bday" min="2000-01-02"><br>
数量 (在1和5之间):
<input type="number" name="quantity" min="1" max="5"><br>
<input type="submit">
</form>
try it"
Browser Support
Internet Explorer 10, Opera, Chrome and Safari support min property.
Note: Firefox or Internet Explorer 9 and earlier versions do not support the min attribute <input> tag.
Note: Because Internet Explorer 10 does not support these types of input, min attribute IE 10 will not apply to the date and time.
Definition and Usage
min attribute specifies the minimum value of <input> elements.
Tip: min attribute and max attribute used in conjunction to create a range of legal values.
Note: max and min attributes apply to the following types of input: number, range, date, datetime , datetime-local, month, time and week.
Differences between HTML 4.01 and HTML5
min attribute is new in HTML5 attributes.
grammar
<input min=" number | date ">
Property Value
值 | 描述 |
---|---|
number | 数字值。规定输入字段允许的最小值。 |
date | 日期。规定输入字段允许的最小值。 |
HTML <input> tag