enterKeyHint
enterkeyhint attribute
The enterkeyhint
attribute in HTML offers guidance to the browser or user agent regarding the action to be taken when the "Enter" key is pressed while an input field is active. It is mainly applied to <input>
and <textarea>
elements.
Syntax
<element enterkeyhint="done|enter|go|next|previous|search|send">
Example
<input type="text" enterkeyhint="search" placeholder="Search here">
Definition and Usage
The enterkeyhint
attribute lets you customize the appearance of the "Enter" key on a virtual keyboard.
Applies to
The enterkeyhint
attribute is a global attribute that can be applied to any HTML element that is editable.
Elements | Attribute |
---|---|
All HTML elements | enterkeyhint |
Attributes values
Value | Description |
---|---|
done | The enter key says "Done" |
enter | The enter key says "enter" |
go | The enter key says "go" |
next | The enter key says "next" |
previous | The enter key says "previous" |
search | The enter key says "search" |
send | The enter key says "send" |
In this example, when the input is focused, the virtual keyboard will display "Search" on the Enter key.
Conclusion
The enterkeyhint
attribute allows customization of the "Enter" key's label on virtual keyboards, improving user experience. It can be applied to any editable HTML element, such as <input>
and <textarea>
. By setting values like "search," "send," or "next," developers can guide users' interactions with form fields.
disabled
The disabled attribute in HTML renders an element unchangeable and non-interactive, preventing user interactions and blocking form submissions for that element.
exportparts
The exportparts attribute in HTML specifies which sections of a web component can be exported, allowing for selective sharing or styling of particular parts of the component.