Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

Is there a minlength validation attribute in HTML5?

It seems the minlength attribute for an <input> field doesn't work.

Is there any other attribute in HTML5 with the help of which I can set the minimal length of a value for fields?
by

2 Answers

akshay1995
Not HTML5, but practical anyway: if you happen to use AngularJS, you can use ng-minlength (or data-ng-minlength) for both inputs and textareas.
pankajshivnani123
I used maxlength and minlength with or without required and it worked for me very well for HTML5.

<input id="passcode" type="password" minlength="8" maxlength="10">

Login / Signup to Answer the Question.