使输入类型=“密码”在移动设备上使用数字键盘 [英] Make Input Type="Password" Use Number Pad on Mobile Devices

查看:294
本文介绍了使输入类型=“密码”在移动设备上使用数字键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我为移动设备设计的网站上,我有一个用于PIN号码的输入字段。我希望文本在输入时被隐藏,并且当移动设备上的用户想要输入PIN码时,我想让数字键盘弹出。当Type =Number时弹出数字键盘,但Type =Password时弹出数字键盘,但我不能(或不知道如何设置)Type =Number and Password。

任何想法?



感谢您!

解决方案

有些浏览器(iOS)会识别特定的 <$ c作为触发数字小键盘的 [0-9] * 的$ c> pattern 属性值。

HTML 5.1 草稿包含 inputmode 属性,它已被设计以解决输入模式(如键盘)选择的具体问题,但它尚未实施。



尽管如此,您可以在将来使用它目前的HTML5.1不允许它为 type = password ,出于某种奇怪的原因。

 < input type =passwordpattern =[0-9] *inputmode =numeric> 


On my site designed for mobile devices I have an input field that is used for PIN numbers. I want the text to be hidden as it is entered and I want the number pad to pop up when the user on the mobile device wants to enter the PIN. The number pad pops up when Type="Number" but not when Type="Password" and I can't (Or don't know how to) set Type="Number and Password".

Any Ideas?

Thanks in advance!

解决方案

Some browsers (iOS) recognize the specific pattern attribute value of [0-9]* as triggering numeric keypad.

The HTML 5.1 draft contains the inputmode attribute, which has been designed to address the specific issue of input mode (like key pad) selection, but it has not been implemented yet.

You could use it for the future, though – even though the current HTML 5.1 does not allow it for type=password, for some odd reason.

<input type="password" pattern="[0-9]*" inputmode="numeric">

这篇关于使输入类型=“密码”在移动设备上使用数字键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆