2

我很难在 OS X 中使用 Firefox 让 jquery 的按键捕捉选项/alt + i。Firefox 也不喜欢选项 u 或 a。我知道这些是为特殊字符保留的,但它适用于 chrome,所以我有点迷茫。这是代码。

$(document).keypress(function(e){
if(e.altKey && String.fromCharCode( e.which ).toLowerCase() == 'i')
    console.log('yes');});

$(document).keyup(function(e){
if(e.altKey && String.fromCharCode( e.which ).toLowerCase() == 'i')
    console.log('yes');});

$(document).keydown(function(e){
if(e.altKey && String.fromCharCode( e.which ).toLowerCase() == 'i')
    console.log('yes');});
4

0 回答 0