如何为网页上的指定输入字段关闭iPhone键盘 [英] How to turn off iPhone keypad for a specified input field on web page

查看:158
本文介绍了如何为网页上的指定输入字段关闭iPhone键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用monthpicker输入(类似于jQuery UI datepicker)来获取信用卡到期字段。

I am using a monthpicker input (similar to jQuery UI datepicker) for a credit card expiration field.

我需要取消iPhone键盘,因为它隐藏了月份选择器。

I need to suppress the iPhone keypad because it hides the month picker.

我试过设置字段只读它并且它不是一个可接受的解决方案 - 在Safari iOS 5.1中,在键盘导航中跳过了只读字段(键盘上的上一个/下一个按钮)。模糊字段也是不可接受的,因为它会触发验证(我们也使用jQuery验证)。

I have tried setting the field to readonly and it is not an acceptable solution - in Safari iOS 5.1 readonly fields are skipped over in keyboard navigation (prev/next buttons on the keypad). Blurring the field is also not acceptable because it triggers validation (we are also using jQuery validation).

有没有办法在没有单个字段的情况下关闭iPhone键盘设置它只读或模糊吗?

Is there a way to turn off the iPhone keyboard on a single field without setting it readonly or blurring it?

推荐答案

我没有遇到隐藏键盘的方法。但你有没有想过显示输入的替代方式。一种选择是使用< input type =month/> ,它会将原生月份选择器带入iOS5。

I haven't come across the way to hide keyboard. But have you thought alternate way of displaying "input". One option would be using <input type="month" /> which brings the native month picker in iOS5.

第二种选择是造型,例如。 span元素作为输入元素(-webkit-appearance在iOS上不起作用),并为元素添加tabindex。这也可以工作,虽然我不知道您正在使用的月份选择器。

Second option would be styling eg. span element as input element (-webkit-appearance not working on iOS), and adding tabindex for the element. This could also work, although I'm not aware of the month picker you're using.

第三个选项 - 在模糊字段时无法阻止验证过程手动触发?

Third option - can't you prevent the validation process when blurring the field is triggered manually?

这篇关于如何为网页上的指定输入字段关闭iPhone键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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