HTML5输入类型编号与电话号码

HTML5输入类型编号与电话号码

本文介绍了HTML5输入类型编号与电话号码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力将某些表单输入更新为HTML5。我对在移动设备上使用数字键盘验证数据不感兴趣。输入类型'tel'似乎做我想做的,我得到iPad /手机上的数字键盘。输入类型'数字'也会给我数字小键盘,但它也包括我不想要的微调框。



我想知道的是,如果它是在信用卡输入上安全使用 type =tel?或者我应该使用 type =number并尝试以某种方式禁用微调器。我正在阅读,禁用微调可能会导致Chrome崩溃,这不是我愿意做出的折衷。

另外,目前我们正在使用完全相同的网站为移动和非移动用户。

解决方案

我看了,只是试过这个似乎可以正常工作。




I'm working on updating some form inputs to HTML5. I'm not interested in validating the data so much as having the numeric key pad on mobile devices. Input type 'tel' seems to do what I want, I get the numeric keypad on iPad/mobile. Input type 'number' will also give me the numeric keypad, but it also includes the spinner box which I don't want.

What I want to know is if it's safe to use type="tel" on a credit card input? Or should I use type="number" and try to disable the spinner somehow. I was reading that disabling the spinner can crash Chrome which isn't a trade off I'm willing to make.

Also, for the time being we're using the exact same site for mobile and non-mobile users.

解决方案

I looked at this and just tried this on my Xoom with the built in browser and FF mobile (with a desktop UA string) and the tel input would seem to work just fine for this.

这篇关于HTML5输入类型编号与电话号码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 15:49