【发布时间】:2016-04-29 18:25:38
【问题描述】:
我一直在使用来自jeresig's hotkey 的 jquery 热键插件。当文档处于焦点时,快捷方式可以正常工作,但是当焦点在输入字段中时,快捷方式不起作用。我使用$(document) 或$(document).find('input') 进行绑定。但这些也不起作用。
我使用以下代码制作快捷方式:
$(document).ready(function(){
shortcutsInit();
});
function shortcutsInit(){
$(document).bind('keydown', "shift+f2", function() {
window.location.replace("/list");
return false;
});
$(document).bind('keydown', "f3", function() {
if($('#searchholder').length){
$('#searchholder').focus();
}
console.log('f3 pressed');
return false;
});
}
【问题讨论】:
标签: javascript jquery jquery-hotkeys