keypress() 上的 Jquery 键盘字符代码的完整列表

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18850557/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 22:37:23  来源:igfitidea点击:

Full list of Jquery keyboard character codes on keypress()

javascriptjqueryhtml

提问by Anton

I know that 13 symbolizes ENTER. But I want to know which number is for A, B, C.. etc.. Does anyone know where I can find a full of list keyboard buttons for jquery keypress.

我知道 13 象征ENTER. 但我想知道 A、B、C 等的数字是什么。有谁知道我在哪里可以找到用于 jquery 按键的完整列表键盘按钮。

$(document).keypress(function (e) {
      if (e.which == 13) {
             $(".car").css("left", "+=25px");
      }
});

回答by Anton

A simple way of of checking out keycodes yourself you could do it like this:

一种自己检查键码的简单方法,您可以这样做:

$('input').on('keydown', function (e) {
    $('label').text(e.keyCode);
});

Demo in JsFiddle

在 JsFiddle 中演示

Also, take a look at this page on Javascript Char Codes (Key Codes)

另外,请查看有关 Javascript Char Codes (Key Codes) 的页面