jeresig's hotkey のjquery hotkeys プラグインを使用しています。ドキュメントにフォーカスがある場合、ショートカットは正常に機能しますが、フォーカスが入力フィールドにある場合、ショートカットは機能しません。私はバインディングに$(document)
orを使用しました。$(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;
});
}