The min and max attributes specify the minimum and maximum value for an <input> element. These attributes work with the following input types: number, range, date, datetime, datetime-local, month, time and week. This example shows <input> elements with min and max values:
HTML file: | Displayed by browser: |
---|---|
Enter a date before 1980-01-01:
<input type="date" name="bday" max="1979-12-31"> <br /> <br />Enter a date after 2000-01-01: <input type="date" name="bday" min="2000-01-02"> <br /> <br />Quantity (between 1 and 5): <input type="number" name="quantity" min="1" max="5"> |
Enter a date before 1980-01-01:
Enter a date after 2000-01-01: Quantity (between 1 and 5): |
This should work with all major browsers, except Firefox. Chrome has the scrollable calendars and vertical numerical sliders.