Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / HTML

enterkeyhint: label the virtual Enter key

Describe the intended action without implementing it through the label.

Version: HTML Living Standard

Syntax

<input type="search" enterkeyhint="search">

The global enterkeyhint attribute suggests the label or icon for Enter on a virtual keyboard. Defined values are enter, done, go, next, previous, search and send. When absent or unsupported, the browser chooses using context. The appearance depends on the platform and input method.

This is not an event handler, a focus-management algorithm or a command to send data. Implement the actual action with appropriate form behavior or script, and keep an accessible control available. It is separate from choosing a keyboard’s character layout. A physical keyboard need not change its printed key.

The example labels a search field’s Enter key and handles the form submission explicitly. A real Enter press submits the field to that handler without navigation. The test verifies form behavior, not the icon shown by a mobile keyboard.

Examples

<!doctype html><meta charset="utf-8">
<form id="form"><label>Find <input id="query" type="search" name="q" enterkeyhint="search" value="HTML"></label><button>Search</button></form><output id="result"></output>
<script>
document.querySelector('#form').addEventListener('submit', event => {
  event.preventDefault();
  document.querySelector('#result').textContent = 'submitted=' + new FormData(event.currentTarget).get('q');
});
// Focus the field and press Enter. The form handler implements the action.
</script>

Result

submitted=HTML

The browser test uses a physical-key event; no mobile keyboard appearance is claimed.

Sources