14

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.

$(document).keypress(function (e) {
      if (e.which == 13) {
             $(".car").css("left", "+=25px");
      }
});
  • 9
    Hi, please remember to always Google first. Thanks! – Pekka Sep 17 '13 at 13:01
  • 6
    This question is better than the comments suggest. It is asking for key codes, not character codes, and the naive answers suggesting a look at ASCII code (whatever that might mean) are just wrong and show that the question is useful. – Jukka K. Korpela Sep 17 '13 at 13:10
  • @Jukka either way, the answer is trivial to find. Just because some people suggest ASCII tables it doesn't mean the question adds any value. The only useful thing here is Anton's answer – Pekka Sep 17 '13 at 13:12
  • It might be trivial to find, but then the constructive approach is to mark it as a duplicate (and perhaps improve the answers to an old question). – Jukka K. Korpela Sep 17 '13 at 13:15
  • 4
    @Jukka that's not a realistic goal for the 7,000 new questions SO gets every day, many of which are of this caliber. The fact that the OP is exceptionally rude doesn't increase the motivation either. People need to invest 30 seconds of homework before asking a question, period. If we can't expect even that, this place is lost. – Pekka Sep 17 '13 at 13:20
  • 1
    @Pekka웃 Many people found (and probably will) find this question useful, contrary to your own belief. I googled about this subject but didn't find much, however, I LEARNED A LOT AFTER I ASKED THIS QUESTION. By the way, maybe you don't know, but no-one is putting a gun to your head to stay in this topic. –  Sep 17 '13 at 13:21
  • The answer gets +3 and the question gets -3! WHY? :) – Vineeth Pradhan Sep 18 '13 at 10:46
  • 1
    Upped 1. I don't know why this is downvoted. jQuerys `keypress` uses different keycodes than `keyup` or the standard JavaScript keycodes. I'd like a full list as well. – ProblemsOfSumit Dec 03 '14 at 11:01
  • 1
    @Pekka웃, you do realize that some of us get this page as one of our first Google results, right? – Max Starkenburg Jul 03 '18 at 15:32
  • @Max yes, these questions often tend to. All the more reason to nuke them really. – Pekka Jul 03 '18 at 15:48

1 Answers1

36

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

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

KyleMit
  • 30,350
  • 66
  • 462
  • 664
Anton
  • 32,245
  • 5
  • 44
  • 54
  • 5
    If you are using jqueryui, the keycodes are already mapped to easily readable labels: http://api.jqueryui.com/jQuery.ui.keyCode/ – evan Sep 02 '14 at 03:56