-
Notifications
You must be signed in to change notification settings - Fork 23.1k
Description
MDN URL
What specific section or headline is this issue about?
Date input types : note
What information was incorrect, unhelpful, or incomplete?
The note in this section suggests replacing <input type="number"> with <input type="tel"> to get the numeric keypad on mobile devices.
Note: It is worth mentioning
<input type="number">here too — this also has a spinner that you can use to increment/decrement values, so potentially suffers from the same problem. However, in the case of thenumbertype the data being collected is simpler, and it is easy to just use atelinput type instead, which has the appearance of text, but displays the numeric keypad in devices with touch keyboards.
However, unlike an <input type="number">, an <input type="tel"> will not validate that the entered value is numeric:
the input value is not automatically validated to a particular format before the form can be submitted, because formats for telephone numbers vary so much around the world.
What did you expect to see?
If the concern is to remove the spinner, then there is a CSS solution for that:
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
appearance: none;
margin: 0;
}
input[type=number] {
appearance: textfield;
}
And if you want a non-numeric input that shows the numeric keypad on mobile devices, it would be better to use the inputmode attribute:
<input type="text" inputmode="decimal">
<input type="text" inputmode="numeric">
Do you have any supporting links, references, or citations?
No response
Do you have anything more you want to share?
No response
MDN metadata
Page report details
- Folder:
en-us/learn_web_development/extensions/forms/advanced_form_styling - MDN URL: https://developer.mozilla.org/en-US/docs/Learn_web_development/Extensions/Forms/Advanced_form_styling
- GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/learn_web_development/extensions/forms/advanced_form_styling/index.md
- Last commit: 2b4a2ad
- Document last modified: 2025-12-19T19:59:21.000Z