在iphone safari webapp中隐藏键盘 [英] hide keyboard in iphone safari webapp

查看:212
本文介绍了在iphone safari webapp中隐藏键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为iPhone创建一个基于HTML / CSS / JS的webapp。我正在使用表单来接收输入并将数据传递给脚本,但我遇到的一个问题是键盘不会消失。用户将输入信息,点击提交,因为它是JavaScript,页面不会重新加载。键盘仍然存在,这是一个麻烦,并为用户增加了另一个步骤(必须关闭它)。

I'm creating a webapp for the iPhone, based in HTML/CSS/JS. I'm using forms to receive input and pass data to the script, but a problem I'm encountering is that the keyboard won't disappear. The user will enter the information, hit submit, and since it's JavaScript the page doesn't reload. The keyboard remains in place, which is a nuisance and adds another step for users (having to close it).

有没有办法强制Safari中的键盘去远?从本质上讲,我有一种感觉,这个问题等同于问我如何强制输入框失去焦点或模糊。在线查看,我发现有很多示例可以检测模糊事件,但没有一个可以强制发生此事件。

Is there any way to force the keyboard in Safari to go away? Essentially, I have a feeling this question is equivalent to asking how I can force an input box to lose focus or to blur. Looking online, I find plenty of examples to detect the blur event, but none to force this event to occur.

推荐答案

更多简单地说,你可以在当前聚焦的元素上调用blur()。 $(#inputWithFocus)。blur()

Even more simply, you can call blur() on the currently focused element. $("#inputWithFocus").blur()

这篇关于在iphone safari webapp中隐藏键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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