HTML minlength attribute
minlength attribute represents the minimum number of characters that a user must enter in the input field. If the value falls below this minlength, input control tells the user to enter the required number of characters.
Username: <input type="text" name="uName" minlength="10" required>
Password: <input type="password" name="uPass" minlength="8" required>
<input type="submit" name="submit">
</>
In the above example, the minlength means the Username should be 10 characters long and the password should be at least 8 characters long. On the contrary, the form will not be submitted.
Attribute values
All possible values of minlength attributeThe value of minlength attribute is a valid positive integer.
Related Tags
The tags that support minlength attribute<input> tag
-
input element allows the user to enter data in the form. This element is used in the form element.
<textarea> tag
-
textarea element defines multiline resizeable textarea. It supports minlength attribute.
Next Previous
Was this article helpful?