ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

HTML5 input inputmode All In One

2022-09-14 13:00:26  阅读:270  来源: 互联网

标签:may inputmode HTML5 key keyboard input type


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

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有