HTML inputmode Attribute (original) (raw)

Last Updated : 30 Aug, 2024

**The inputmode attribute in HTML is used to provide a hint to browsers about the type of input expected from the user. The 'inputmode' attribute allows you to specify the type of data expected to be entered into a text field on a phone or tablet (any device with a virtual keyboard).

**Note: Using **inputmodeattributes is a must while dealing with textboxes as it increases the ease of user Input.

**Syntax:

The**inputmode attribute can have the following values.

Table of Content

**None:

The value **none implies 'no' onscreen keyboard to be displayed. This is used in those cases where the browser or any application is handling the VK (Virtual Keyboard) by itself (self-coded).

Syntax:

**Text:

The value **text displays the locale-specific standard keyboard.

**Syntax:

inputmode=text On Android 11

**Numeric:

The value _**numeric_assures that digits from 0 to 9 should be displayed on the on-screen keyboard. 'Minus' key may or may not be displayed.

Syntax:

inputmode=numeric On Android 11

**Decimal:

The value **decimal assures that along with digits from 0 to 9 the locale-specific decimal separator ("." or ",") must be displayed. 'Minus' key may or may not be displayed.

**Syntax:

inputmode=decimal On Android 11

**tel:

The value **tel displays numeric on-screen keyboard along with pound (*) and asterisk(*) keys. This is used for entering telephone numbers.

inputmode=tel On Android 11

The value **search assuresthat the on-screen keyboard should have such a layout that it's convenient for searching , such a layout has an "**Enter" key labelled as "**Search" or maybe any search icon or similar.

inputmode=search On Android 11

**email:

The value **email assures that the on-screen keyboard must display "****@**" character which will facilitate the user for email input.

inputmode=email On Android 11

**URL:

The value **url assures that the on-screen keyboard must display "****/**" character which will facilitate the user in entering the URL.

**Syntax:

inputmode=url On Android 11

**Example: In this example we will see the input mode attribute with help of an HTML document.

HTML `

HTML inputmode Attribute

GeeksforGeeks

<h3>HTML inputmode Attribute</h3>

Name : <input type="text" id="text" 
              inputmode="text" /><br><br>

Phone No. : <input type="tel" id="phone" 
                   inputmode="tel" /><br><br>

Email : <input type="email" id="email" 
               inputmode="email" /><br><br>

Age : <input type="number" id="age" 
             inputmode="numeric" /><br><br>

Search : <input type="search" id="search" 
                inputmode="search" /><br><br>

URL : <input type="url" id="url" 
             inputmode="url" /><br><br>

`

**Output:

**Supported Browsers: