inputmode
is a global attribute (i.e. works on more than just input
elements) that acts as a hint for browsers to display a specific on-screen keyboard depending on the value given. This is very useful for only showing relevant input based on the input, e.g. a on-screen numpad for a telephone input.
This attribute differs from type
, which also changes the way the browser interprets the input. type
may offer a completely different input (e.g. a slider for type=range
), as well as in-built validation, among other things.
It's usually better to use type
as it affords more accessibility and features, such as requiring a specific input
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode https://css-tricks.com/everything-you-ever-wanted-to-know-about-inputmode/