Maxlength is not working with type="number"
Asked
Active
Viewed 3,739 times
2
-
6Take a look at this! http://stackoverflow.com/questions/8354975/how-to-add-maxlength-for-html5-input-type-number-element – Mattias Lindberg Dec 08 '15 at 07:22
3 Answers
4
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.

Yeldar Kurmangaliyev
- 33,467
- 12
- 59
- 101
0
You should use this instead
<input type="number" name="MyInteger" min="1" max="99">

Tomasz Jakub Rup
- 10,502
- 7
- 48
- 49

Tanmay
- 590
- 8
- 20