enterkeyhint

enterkeyhint 全局属性enumerated 属性,定义为虚拟键盘上的 Enter 键呈现什么操作标签(或图标)。

¥The enterkeyhint global attribute is an enumerated attribute defining what action label (or icon) to present for the enter key on virtual keyboards.

Try it

描述

¥Description

表单控件(例如 <textarea><input> 元素)或使用 contenteditable 的元素可以指定 inputmode 属性来控制将使用哪种虚拟键盘。为了进一步改善用户体验,可以专门定制回车键,通过提供 enterkeyhint 属性来指示回车键应该如何标记(或者应该显示哪个图标)。Enter 键通常代表用户下一步应该做什么;典型的动作有:发送文本、插入新行或搜索。

¥Form controls (such as <textarea> or <input> elements) or elements using contenteditable can specify an inputmode attribute to control what kind of virtual keyboard will be used. To further improve the user's experience, the enter key can be customized specifically by providing an enterkeyhint attribute indicating how the enter key should be labeled (or which icon should be shown). The enter key usually represents what the user should do next; typical actions are: sending text, inserting a new line, or searching.

如果未提供 enterkeyhint 属性,则用户代理可能会使用 inputmodetypepattern 属性中的上下文信息来显示合适的输入键标签(或图标)。

¥If no enterkeyhint attribute is provided, the user agent might use contextual information from the inputmode, type, or pattern attributes to display a suitable enter key label (or icon).

¥Values

enterkeyhint 属性是 enumerated 属性,并且仅接受以下值:

¥The enterkeyhint attribute is an enumerated attribute and only accepts the following values:

描述 标签示例(取决于用户代理和用户语言)
enterkeyhint="enter" 通常插入新行。
enterkeyhint="done" 通常意味着无需再输入任何内容,并且输入法编辑器 (IME) 将关闭。 Done
enterkeyhint="go" 通常意味着将用户带到他们键入的文本的目标。 Open
enterkeyhint="next" 通常将用户带到下一个接受文本的字段。 Next
enterkeyhint="previous" 通常将用户带到将接受文本的上一个字段。 Previous
enterkeyhint="search" 通常会将用户带到搜索他们键入的文本的结果。 Search
enterkeyhint="send" 通常将文本传递给目标。 Send

规范

Specification
HTML Standard
# attr-enterkeyhint

¥Specifications

浏览器兼容性

BCD tables only load in the browser

¥Browser compatibility

也可以看看

¥See also