Dofactory.com
Dofactory.com
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

HTML <input> max Attribute

The max attribute on an <input> tag sets the maximum value for that element.

The input element must be of a type that accept numeric, date, or time values.

Example

#

A max attribute on a number <input> element.
A maximum value that can be entered in this number input is set.

Quantity  

<form action="/tutorial/action.html">
  Quantity &nbsp;
  <input type="number" name="number" min="1" max="10" value="7"> 
  
  <br /> <br />
  <input type="submit">
</form>

Using max

The max attribute specifies the maximum value allowed in an input field.

This attribute only applies to these input types:

With numbers, the max value must be greater than the min value. For dates this is not required.


Syntax

<input max="number | datetime">

Values

#

Value Description
number The maximum numeric value in an input field.
datetime The maximum datetime value in an input field.

Browser support

Here is when max support started for each browser:

Chrome
5.0 May 2010
Firefox
16.0 Oct 2012
IE/Edge
10.0 Sep 2012
Opera
10.6 Jul 2010
Safari
5.1 Oct 2011

You may also like

 Back to <input>

Last updated on Sep 30, 2023

Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides