HTML enterkeyhint Attribute

Beginner
6 min read
Updated: Nov 2026
3 examples
Live preview

Definition and Usage

The enterkeyhint global attribute suggests which label a virtual keyboard should show on its Enter key. Pick a value that matches the field’s job: search for a query box, send for a chat composer, next / previous for multi-step forms, or done when editing is finished.

Pair it with inputmode when you also need a different keyboard layout. Neither attribute replaces proper type on inputs.

Baseline · Widely available (mobile).

Modern mobile browsers honor the hint. Physical keyboards are unchanged.

Hint only.

Browsers may ignore the value or map several keywords to the same caption. Always wire real submit / focus behavior in HTML or script.

HTML Syntax

syntax.html
<element enterkeyhint ="enter|done|go|next|previous|search|send">

Global attribute. Most useful on editable form controls shown with a virtual keyboard.

Attribute Values

ValueDescriptionTry it
enterDefault Insert a new line / generic EnterTry it
doneEditing complete — dismiss keyboardTry it
goNavigate to a destination (e.g. URL bar feel)Try it
nextMove to the next fieldTry it
previousMove to the previous fieldTry it
searchTake the user to search resultsTry it
sendSend the text (chat / message)Try it

Live Preview

Change enterkeyhint on a text field. On a phone, focus the field and inspect the Enter key label.

Desktop keyboards will not change. Use a mobile device or emulator for a real Enter label.

Result

enterkeyhint="done"

HTML Examples

Example 1 — done on the Last Field

Signal that the keyboard can be dismissed when the user finishes this field.

HTML
<label for="bio">Short bio</label>
<textarea id="bio" name="bio" rows="3" enterkeyhint="done"></textarea>
Try It Yourself

How It Works

  1. Choose done. The Enter key suggests completion rather than a new line-only action.
  2. Last field. Works well at the end of a short form.
  3. Still a hint. Wire real submit with a button if you need a guarantee.
  4. Test on mobile. Labels vary by OS and keyboard app.

Example 2 — next in a Multi-Step Form

Guide users through sequential fields with next and previous hints.

HTML
<label for="first">First name</label>
<input id="first" name="first" enterkeyhint="next">

<label for="last">Last name</label>
<input id="last" name="last" enterkeyhint="done">
Try It Yourself

How It Works

  1. Use next on early fields to imply “continue”.
  2. Use done (or go) on the final field.
  3. Focus management may still need script if you want guaranteed field advance.
  4. previous is available when stepping backward makes sense.

Edge Cases & Pitfalls

The attribute never replaces real form actions or focus scripts.

desktop

No physical key change

Laptop Enter keys keep the same label. Test on real phones.

vs inputmode

Different concern

inputmode picks the layout; enterkeyhint only styles the Enter affordance.

behavior

Label ≠ action

Showing Search does not automatically run your search — wire the form or script.

textarea

Newlines still matter

On multiline fields, Enter may still insert a line break depending on the browser and hint.

Browser Support

enterkeyhint is an HTML attribute for browsers. It is not a Node.js, Deno, or Bun API.

✓ Baseline · Widely available (mobile)

enterkeyhint

Supported across modern mobile browsers. Desktop typically shows no visible change.

95% Global support (approx.)
Google Chrome 77+
Full support
Mozilla Firefox 79+
Full support
Apple Safari 13.1+
Full support
Microsoft Edge 79+
Full support
Opera 64+
Full support
Samsung Internet 12+
Full support
Internet Explorer No support
Not supported
enterkeyhint Widely supported

Bottom line: Safe to use. Progressive enhancement for virtual keyboards.

Key Takeaways

  • Role: label the virtual Enter key for the field’s job.
  • Values: enter, done, go, next, previous, search, send.
  • Mobile: primary benefit is on soft keyboards.
  • Still wire actions with forms or script.

One line: enterkeyhint makes the soft Enter key say what the field will do.

Frequently Asked Questions

It hints which action label the virtual keyboard should show on the Enter key — for example next, done, search, or send. It does not change desktop physical keyboards.
enter, done, go, next, previous, search, and send.
Not by itself. The label is a hint. What happens on key press still depends on the control, form, and browser (for example search fields often submit).
No. inputmode chooses the keyboard layout (numeric, email, …). enterkeyhint only customizes the Enter key’s caption/action affordance.
Use next on mid-flow fields in a multi-step form; use done on the last field when the keyboard should signal completion.
It is widely available on modern mobile browsers. Desktop usually shows no visible effect.

Next: exportparts

Re-export nested shadow CSS parts for ::part() styling.

exportparts tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful