问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/8216278/html5-input-type-number-vs-tel