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?
htmlhtml5-validation
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?
Best Answer
You can use the
pattern
attribute. Therequired
attribute is also needed, otherwise an input field with an empty value will be excluded from constraint validation.If you want to create the option to use the pattern for "empty, or minimum length", you could do the following: