Reputation: 30568
I know the input have the maxlength, but I would like to have minlength as my personal application for define, can I have this abilities? of course, the behavior is implemented by javascript, instead of the browser, can I do so?
Upvotes: 1
Views: 64
Reputation: 490153
Yes, you can do that.
To make it validate with HTML5, prefix your custom attribute with data-
.
You can get the minlength
attribute in JavaScript with...
var minLength = +inputElement.getAttribute('data-minlength');
Upvotes: 3