New in HTML5.

<input min=””>

Sharing is caring!

Attribute of
Input As The Fundamental Form Element In HTML: Here's What It Does
What does <input min=""> do?
Specifies a minimum value for number and date input fields.

Code Example

 <label for="hours">How many hours are you available to work each week?</label><br>
 <input type="number" id="hours" name="hours" min="15">

<!-- 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.

Adam is a technical writer who specializes in developer documentation and tutorials.

Browser Support for min