Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML input max attribute

HTML max property

HTML input Tag Reference HTML tag

Example

Using the min and max attributes:

  Enter a date before 1980-01-01:

 

  Enter a date after 2000-01-01:

 

  Quantity (between 1 and 5):

 

 

Try it »


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer 10, Opera, Chrome, and Safari support the max attribute.

**Note:** Firefox or Internet Explorer 9 and earlier versions do not support the max attribute of the tag.

**Note:** Since Internet Explorer 10 does not support these input types, the max attribute will not work with date and time in IE 10.


Definition and Usage

The max attribute specifies the maximum value of the element.

**Tip:** The max attribute is used together with the min attribute to create a range of legal values.

**Note:** The max and min attributes apply to the following input types: number, range, date, datetime, datetime-local, month, time, and week.


Differences between HTML 4.01 and HTML5

The max attribute is new in HTML5.


Syntax

Attribute values

Value Description
number A number. Specifies the maximum value allowed in the input field.
date A date. Specifies the maximum value allowed in the input field.

HTML input Tag Reference HTML tag