Use of the min and max attributes.
The min
attribute specifies the minimum value for an <input>
element.
Tip: Use the min
attribute together with the max
attribute to create a range of legal values.
Note: The max
and min
attributes works with the following input types: number, range, date, datetime-local, month, time and week.
The numbers in the table specify the first browser version that fully supports the attribute.
<input min="number|date">
Value | Description |
---|---|
number | Specifies the minimum value allowed |
date | Specifies the minimum date allowed |
Example:
HTML
<label for="quantity">Quantity (between 1 and 5):</label>
<input type="number" id="quantity" name="quantity" min="1" max="5">
Type: | Html |
Category: | Web Tutorial |
Sub Category: | HTML Tag |
Uploaded by: | Admin |