keyCode on android is always 229

后端 未结 7 1431
长情又很酷
长情又很酷 2020-11-28 08:23

On my Samsung Galaxy tab 4 (Android 4.4.2, Chrome: 49.0.2623.105) I ran into a situation where the keyCode is always 229.

I\'ve setup a simple test for two situatio

7条回答
  •  清酒与你
    2020-11-28 09:13

    I was having the same issue on Samsung S7 phones. Solved it by replacing event from keydown to keypress.

    $("div, input").keypress(function (e) {
        $("#keycode").html(e.which); 
    });
    

    jQuery normalizes this stuff, so there's no need to use anything other than e.which https://stackoverflow.com/a/302161/259881

提交回复
热议问题