捕获CTRL +在Firefox中
问题描述:
按键事件我使用这个代码来捕捉键盘按下事件:捕获CTRL +在Firefox中
$(document.body).keypress(function(e){
console.log("captured: " + e.which);
});
在Chrome,当用户按下CTRL + [R,我得到中charCode 18。
然而,在Firefox上,我得到114,换句话说就是r没有CTRL。
如何捕获Firefox上的CTRL +事件?最好,我想只接收正确的charcode而不使用任何翻译表。
答
$(document).on('keydown', function(e){
console.log("captured: " + e.which);
});