The min and max attributes designate the minimum and maximum values for an input field.
These attributes are compatible with input types such as number, range, date, datetime-local, month, time, and week.
Tip: Employ the max and min attributes simultaneously to establish a range of acceptable values.
Example
Define a maximum date, a minimum date, and a range of valid values:
<form> <label for=”datemax”>Enter a date before 1980-01-01:</label> <input type=”date” id=”datemax” name=”datemax” max=”1979-12-31″><br><br> <label for=”datemin”>Enter a date after 2000-01-01:</label> <input type=”date” id=”datemin” name=”datemin” min=”2000-01-02″><br><br> <label for=”quantity”>Quantity (between 1 and 5):</label> <input type=”number” id=”quantity” name=”quantity” min=”1″ max=”5″> </form> |
The input multiple attribute allows the user to enter more than one value in an input field.
This attribute is applicable to the email and file input types.
Example
A file upload field that allows multiple files:
<form> <label for=”files”>Select files:</label> <input type=”file” id=”files” name=”files” multiple> </form> |