HTML <input> Tag with the 'minlength' Attribute
<form name="myForm" action="http://www.htmlcodes.ws/resources/html-forms-action.cfm"> <input minlength="5" name="myField"> <button>Submit</button> </form>
The above example demonstrates usage of the
<input> element with the
minlength attribute allows you to restrict the length of the value that the user can input. Specifically, it allows you to specify a minimum number of characters that the user can input.
You can also use
maxlength to specify a maximum length.
Note that at the time of writing, the
minlength attribute was new to HTML and had very little browser support.