Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • 1
    Because the input is a single char. Commented Aug 2, 2021 at 20:49
  • 2
    How about <input type="number" min="0" max="99"> ? Commented Aug 2, 2021 at 20:49
  • type=number wont work in firefox, also with that the user can still type in more digits than 2 Commented Aug 2, 2021 at 20:50
  • If you have a strict requirement on the number length you should not forget to check it on server side, both input field and JavaScript can be bypassed by the user. Commented Aug 2, 2021 at 20:55