English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The max attribute specifies the maximum value of the <input> element, the max and min attributes are applicable to the following input types: number, range, date, datetime, datetime-local-local, month, time, and week.
Demonstration of the use of min and max attributes:
<!DOCTYPE html> <html> <head> <title>HTML: <input> max and min attributes - Basic Tutorial Website(oldtoolbag.com)</title> <body> <form action="action_page.php"> input1999year11month31date before today: <input type="date" name="bday" max="1999-11-31><br> input2010year1month2date after today: <input type="date" name="bday" min="2010-01-02><br> quantity(1to5between): <input type="number" name="quantity" min="1" max="5><br> <input type="go submit"> </form> </html>Test and see ‹/›
IEFirefoxOperaChromeSafari
Internet Explorer 10Opera, Chrome, and Safari support the max attribute.
Note:Firefox or Internet Explorer 9 and earlier versions do not support the max attribute of the <input> tag.
Note:Due to Internet Explorer 10 These input types are not supported, the max attribute will not be applicable to IE 10 of date and time.
The max attribute specifies the maximum value of the <input> element.
Tip:The max attribute is compatible with min attributes in combination can create a valid value range.
Note:The max and min attributes are applicable to the following input types: number, range, date, datetime, datetime-local, month, time, and week.
The max attribute is an HTML5 of the new attributes.
<input max="number|date">
Value | Description |
---|---|
number | Numeric value. Specifies the maximum allowed value for the input field. |
date | Date. Specifies the maximum allowed value for the input field. |