HTML inputmode Attribute

Definition and Usage

inputmode The attribute allows you to change the appearance of the keyboard on smartphones or tablets (any device with a virtual keyboard).

See also:

HTML Tutorial:HTML Attributes

Example

Tip:Please run the example on a smartphone or tablet to see the results.

Example 1

Only numeric keys are displayed on the (virtual) keyboard:

<input type="text" inputmode="numeric">
The result displayed on mobile phones by the inputmode attribute

try it yourself

Example 2

The following example uses the "email" inputmode:

<input type="text" inputmode="email">
The result displayed on mobile phones by the inputmode attribute

try it yourself

syntax

<element inputmode="decimal|email|none|numeric|search|tel|text|url">

Attribute Value

Value Description
decimal Only shows numeric keyboard, usually with a comma key.
email Text keyboard, keys are usually used for email addresses, such as [@].
none Keyboard should not appear.
numeric Only shows numeric keyboard.
search Text keyboard, the [enter] key is usually displayed as [go].
tel Only shows numeric keyboard, usually with [+]、[*] and [#] keys.
text Default. Text keyboard.
url Text keyboard, keys are usually used for URLs, such as [.] and [/], as well as special [.com] keys, or other domain name endings commonly used for local settings.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
66 79 95 12.2 53