<input min="">
- Attribute of
- How To Use Input To Create Form Fields In HTML: Easy Tutorial
- What does
<input min="">
do? - Specifies a minimum value for number and date input fields.
Code Example
<form>
<label for="hours">How many hours are you available to work each week?</label><br>
<input type="number" id="hours" name="hours" min="15">
</form>
<!-- Try putting in 10 and pressing enter. -->
The min
attribute and data validation
The min
attribute works on <input>
elements of the numeric
or date
type
. It provides you a Javascript-free form of light-weight form data validation — user inputs below the minimum are not accepted by the form. However, it is important to remember that this is not a sufficient data validation technique. Using the min
attribute, like all other HTML-based data validation, should be thought of as helpful to the user, more than helpful to you as a developer. Because of the way forms work, it is still possible for malicious users (or users with old browsers, even) to provide data outside the range specified by the min
and max
attributes. So you will still need to handle data validation (and sanitization) on the server.
Browser Support for min
10 | 43 | 45 | 13 | 9 | 34 |