& ldquo; maxlength & rdquo; does not work with input type = & ldquo; number & rdquo; in the HTML text box

advertisements

Maxlength is not working with type="number"


There is no maxlength attribute for number input.

There are max and min attributes instead.

This HTML will provide a number with the maximum length of 3:

<input type="number" min="0" max="999"/>

Note that it is still possible to enter bigger numbers manually.