如何在PhoneGap应用程序的jQueryMobile页面中隐藏键盘? [英] How to hide keyboard in jQueryMobile page in a Phonegap app?

查看:252
本文介绍了如何在PhoneGap应用程序的jQueryMobile页面中隐藏键盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iPhone模拟器中隐藏键盘有问题。我的HTML代码:

 < form id =my_form> 
< input type =searchid =searchBar/>
< / form>

jQuery代码:

  $(#my_form)。submit(function(){
one = $('#searchBar')。val();
console.log(one);
doSearch(one);
return false;
});

一切都按我的需要工作:我可以获得表单值并执行一些Ajax。但是当函数返回false时,iPhone模拟器中的虚拟键盘仍然可见。如何隐藏键盘?还有另一种方法吗?当用户在iPhone上搜索并按Go时,我需要使用Ajax将数据传递到服务器。搜索结果应显示在同一页(已完成)中。



感谢,



- regeint

解决方案

谢谢 Hosh Sadiq techfoobar 帮助我。
其实我做了以下和它的工作。
它不影响该元素之上或之下的css。

  $('。clr')。after '< input type =checkboxid =focusablestyle =height:0; margin-left:-200px; clear:both;/>') 
$('#focusable')。focus();

再次感谢。 :)


I have a problem with hiding keyboard in the iPhone simulator. My HTML code:

<form id="my_form">
    <input type="search" id="searchBar" />
</form>

jQuery code:

$("#my_form").submit(function() {
  one = $('#searchBar').val();
  console.log(one);
  doSearch(one);
  return false;
});

Everything works as I need: I can get form value and perform some Ajax. But when the function returns false, the virtual keyboard in the iPhone simulator is still visible. How to hide the keyboard? Is there another method to do that? I need to pass data to the server using Ajax when the user searches and presses 'Go' on the iPhone. The search result should be shown in the same page (already done). The user can again search in the same page.

Please help me.

Thanks,

--regeint

解决方案

Thank you Hosh Sadiq and techfoobar for helping me. Actually I did the following and it worked. It did not effect the css above or below this element.

$('.clr').after('<input type="checkbox" id="focusable" style="height:0; margin-left:-200px; clear: both;" />');
$('#focusable').focus(); 

Thanks once again. :)

这篇关于如何在PhoneGap应用程序的jQueryMobile页面中隐藏键盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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