input max Attribute - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:input

Description

The max attribute specifies the maximum value for an <input> element.

The max and min attributes works with the following input types: number, range, date, datetime, datetime-local, month, time and week.

Attribute Values

Value Description
number Specifies the maximum value allowed
date Specifies the maximum date allowed

The following code shows how to Use of the min and max attributes:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form action="/action_page.php">
  Enter a date before 1980-01-01:
  <input type="date" name="bday" max="1979-12-31"><br>

  Enter a date after 2000-01-01:
  <input type="date" name="bday" min="2000-01-02"><br>

  Quantity (between 1 and 5):<!--from ww  w . ja  v  a 2s  .c om-->
  <input type="number" name="quantity" min="1" max="5"><br>

  <input type="submit">
</form>

</body>
</html>

Related Tutorials