1

我认为这是一种常见的模式:

  1. 我有一个 jquery 移动搜索框<input type="search"...>
  2. 输入回车时,执行提交,但键盘仍然存在(在我的android上)
  3. 键盘隐藏在我的桌面开发环境中。

经过大量搜索,我尝试过:

 if (e.keyCode == 13) {

    console.log("Im here");

    $('.ui-input-text').trigger('blur');

    $(this).trigger('blur');

    $("input").trigger('blur');

    $("#goSomewhereElse").focus();

    $('input#SearchText').blur(); 

}

似乎没有任何效果。关于如何隐藏键盘的任何建议?

4

1 回答 1

0
if (event.keyCode == 13) 
{
  window.location.hash = '#submit_chat_msg';
}

其中 'submit_chat_msg' 是按钮的 ID 或其他东西。

于 2014-07-09T05:02:13.020 回答