How to add minlength validation attribute in HTML5?

Spread the love

Sometimes, we want to add minlength validation attribute in HTML5.

In this article, we’ll look at how to add minlength validation attribute in HTML5.

How to add minlength validation attribute in HTML5?

To add minlength validation attribute in HTML5, we set the minlength attribute.

For instance, we write

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

to set the minlength attribute to 8 to validate that the input value has at least 8 characters.

Conclusion

To add minlength validation attribute in HTML5, we set the minlength attribute.

Leave a Reply

Your email address will not be published.