如何隐藏键盘jQuery Mobile的编程焦点() [英] how to hide keyboard in jquery mobile programmatically on focus()

查看:598
本文介绍了如何隐藏键盘jQuery Mobile的编程焦点()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想隐藏的对象聚焦()的键盘,但是当 $(UI输入文本。)专注(); 它会自动打开键盘 。

I want to hide the keyboard on Focus(),but when $(".ui-input-text").focus(); it will automatically open the keyboard .

我只是想在特定的屏幕隐藏,我有测试与 document.activeElement.blur(); 但它也没有集中()输入。

I just want to hide in particular screen ,I have test with document.activeElement.blur(); but it also did not focus() on input .

推荐答案

在提交表单,有时,iOS的键盘可能不会自动关闭。这是相当的用户不应该需要手动关闭键盘的应用案例中,他们本来没有想到需要做这样一个可用性问题。

When submitting a form, at times, the iOS Keyboard may not automatically close. This is quite a usability issue as Users should not be required to manually close the Keyboard for use-cases in which they would otherwise not expect the need do so.

有一个简单的解决方案可以通过调用document.activeElement,从而有效地使人们以编程方式隐藏键盘模糊方法实现:

A simple solution for this can be implemented by invoking the blur method on document.activeElement, which effectively allows one to programmatically hide the keyboard:

// automatically close the keyboard on iOS
document.activeElement.blur();

更多关于HTML5和移动应用程序的事件。

More about HTML5 and Mobile application events ..

<一个href="http://www.ericfeminella.com/blog/2012/12/27/ios-html5-input-element-tips/">http://www.ericfeminella.com/blog/2012/12/27/ios-html5-input-element-tips/

这篇关于如何隐藏键盘jQuery Mobile的编程焦点()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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