HTML <input> minlength attribute
Definition and Usage
minlength
The attribute specifies the minimum number of characters required in the <input> element.
Attention:minlength
The attribute can be used for the following input types:
- text
- search
- url
- tel
- password
Example
An <input> element with a minimum length of 8 characters:
<form action="/action_page.php"> <label for="password">Password:</label> <input type="password" id="password" name="password" minlength="8"><br><br> <input type="submit" value="Submit"> </form>
Syntax
<input minlength="number">
Attribute Value
Value | Description |
---|---|
number | The minimum number of characters required in the <input> element. |
Browser Support
The numbers in the table indicate the first browser version to fully support the property.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
40.0 | 17.0 | 51.0 | 10.1 | 27.0 |