2

Maxlength is not working with type="number"

Amit Verma
  • 23
  • 1
  • 4

3 Answers3

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
1

Try this

<input type="number" max="100"/>
Raza Ali Poonja
  • 1,086
  • 8
  • 16
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