HTMLElement: enterKeyHint property
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.
TheenterKeyHint property is an enumerated property definingwhat action label (or icon) to present for the enter key on virtual keyboards.It reflects theenterkeyhintHTML global attribute and is an enumerated property, only accepting the following valuesas a string:
'enter'typically indicating inserting a new line.'done'typically meaning there is nothing more to input and the input method editor (IME) will be closed.'go'typically meaning to take the user to the target of the text they typed.'next'typically taking the user to the next field that will accept text.'previous'typically taking the user to the previous field that will accept text.'search'typically taking the user to the results of searching for the text they have typed.'send'typically delivering the text to its target.
If noenterKeyHint value has been specified or if it was set to a different value than the allowed ones, it will return an empty string.
In this article
Examples
Give a virtual keyboard a hint how to label the enter key (might render asSend andSearch, depending on the OS or the user's language).
js
const send = document.getElementById("sendInput");const search = document.getElementById("searchInput");send.enterKeyHint = "send";search.enterKeyHint = "search";Specifications
| Specification |
|---|
| HTML> # dom-enterkeyhint> |
Browser compatibility
See also
enterkeyhintHTML global attribute