jquery:
$('#search').keypress(function(e) {
if (e.keyCode == 13) {
$('#search').blur();
}
});
HTML:
<div>
<input id="search" type="text">
</div>
我想要detect
enter
(或去)key event
在jquery
当按键 mobile devices
时喜欢 android
,一旦按下该键,我需要 blur
输入框字段。
但是我上面的jquery代码是not working
。请帮我。
最佳答案
重新编辑:
$('#search').on('keyup',function(e) {
if (e.keyCode == 13) {
$('#search').blur();
}
});
关于javascript - android 输入键事件在 jquery 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53077887/