其他分享
首页 > 其他分享> > HTML5 input inputmode All In One

HTML5 input inputmode All In One

作者:互联网

HTML5 input inputmode All In One

inputmode 是一种自动适配键盘类型的增强模式, 不是用来 代替 input type 输入框的!

inputmode

The inputmode global attribute is an enumerated attribute that hints at the type of data that might be entered by the user while editing the element or its contents.
This allows a browser to display an appropriate virtual keyboard.

inputmode 全局属性是一个枚举属性,它提示用户在编辑元素或其内容时可能输入数据类型
这允许浏览器显示适当的虚拟键盘

It is used primarily on <input> elements, but is usable on any element in contenteditable mode.

它主要用于 <input> 元素,但可用于任何处于 contenteditable 模式的元素。

It's important to understand that the inputmode attribute doesn't cause any validity requirements to be enforced on input.
To require that input conforms to a particular data type, choose an appropriate <input> element type.

重要的是要了解 inputmode 属性不会导致对输入强制执行任何有效性要求。
要要求输入符合特定数据类型,请选择适当的 <input> 元素类型。

none
No virtual keyboard. For when the page implements its own keyboard input control.

text (default value)
Standard input keyboard for the user's current locale.

decimal
Fractional numeric input keyboard containing the digits and decimal separator for the user's locale (typically . or ,). Devices may or may not show a minus key (-).

numeric
Numeric input keyboard, but only requires the digits 0–9. Devices may or may not show a minus key.

tel
A telephone keypad input, including the digits 0–9, the asterisk (*), and the pound (#) key. Inputs that *require* a telephone number should typically use <input type="tel"> instead.

search
A virtual keyboard optimized for search input. For instance, the return/submit key may be labeled "Search", along with possible other optimizations. Inputs that require a search query should typically use <input type="search"> instead.

email
A virtual keyboard optimized for entering email addresses. Typically includes the @character as well as other optimizations. Inputs that require email addresses should typically use <input type="email"> instead.

url
A keypad optimized for entering URLs. This may have the / key more prominent, for example. Enhanced features could include history access and so on. Inputs that require a URL should typically use <input type="url"> instead.



input type

demos

<iframe allowfullscreen="true" allowtransparency="true" frameborder="no" height="463.590576171875" loading="lazy" scrolling="no" src="https://codepen.io/xgqfrms/embed/poVNNJa?default-tab=result&theme-id=dark" style="width: 100%" title="html5 input inputmode All In One"> See the Pen html5 input inputmode All In One by xgqfrms (@xgqfrms) on CodePen. </iframe>

refs

https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input



©xgqfrms 2012-2020

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载

标签:may,inputmode,HTML5,key,keyboard,input,type
来源: https://www.cnblogs.com/xgqfrms/p/16692656.html