2012-08-10 80 views

回答

1

你必须从输入字段使用JavaScript手动删除的重点是这样的:

$('.ui-listview-filter .ui-input-text').live('keyup', function(event) { 
    if (event.keyCode == 13) { 
     // 'Go' pressed 
     $('.ui-listview-filter .ui-input-text').trigger('blur'); 
    } 
}); 
+0

这正是我所需要的!谢谢。 – rdkit 2012-08-10 09:47:08

0

您可能想要在按下按键后尝试更改焦点。例如:

//this will un-select the text box, hiding keyboard 
$('#searchInputId').blur(); 

//this will focus on something else, hiding keyboard 
$('#somethingOtherThanTheSearch').focus(); 
0

Pablo的答案的变体,它在我的jQuery(移动)的过时的版本作品:

// this is here to close the on-screen keyboards of mobile devices when the "go" button is used 
    $("input[data-type='search']").on('keyup', function(event) { 
    if (event.keyCode == 13) { // Enter or 'Go' pressed 
     event.target.blur(); // remove focus on the search field so keyboard goes away 
    } 
});