Maxlength and Minlength ignored for input type=“number”

Viewed 2300

The maxlength attribute is not working with

<input type="number" maxlength="5" maxlength="10" />
1 Answers

HTML input type number does not have maxlength and minlength attribute, instead it has min and max attribute, you can use min and max to length of input.

For eg. for maxlength 2 and minlength 0, you can use min and max like this-

<input type="number" min="0" max="99" />
Related