HTML enterkeyhint global attribute
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since November 2021.
Theenterkeyhintglobal attributeis anenumerated attribute defining what action label (or icon) to present for the enter key on virtual keyboards.
In this article
Try it
<input enterkeyhint="go" /><p contenteditable enterkeyhint="go">https://example.org</p>Description
Form controls (such as<textarea>or<input> elements) or elements usingcontenteditable can specify aninputmode attribute to control what kind of virtual keyboardwill be used. To further improve the user's experience, the enter key can be customized specifically by providing anenterkeyhintattribute indicating how the enter key should be labeled (or which icon should be shown). The enter key usuallyrepresents what the user should do next; typical actions are: sending text, inserting a new line, or searching.
If noenterkeyhint attribute is provided, the user agent might use contextual information from theinputmode,type,orpatternattributes to display a suitable enter key label (or icon).
Value
Theenterkeyhint attribute is anenumerated attribute and only accepts the following values:
| Value | Description | Example label (depends on user agent and user language) |
|---|---|---|
enterkeyhint="enter" | Typically inserting a new line. | return,↵ |
enterkeyhint="done" | Typically meaning there is nothing more to input and the input method editor (IME) will be closed. | done,✅ |
enterkeyhint="go" | Typically meaning to take the user to the target of the text they typed. | go,🡢 |
enterkeyhint="next" | Typically taking the user to the next field that will accept text. | next,⇥ |
enterkeyhint="previous" | Typically taking the user to the previous field that will accept text. | return,⇤ |
enterkeyhint="search" | Typically taking the user to the results of searching for the text they have typed. | search,🔍 |
enterkeyhint="send" | Typically delivering the text to its target. | send |
Specifications
| Specification |
|---|
| HTML> # attr-enterkeyhint> |
Browser compatibility
See also
HTMLElement.enterKeyHintproperty reflecting this attributeinputmodeglobal attributecontenteditableglobal attributetypeandpatternattributes on<input>elements