145

Which is the key on the keyboard having the keycode as 13?

switch(key) {
  case 37: 
    $.keynav.goLeft();
    break;
  case 38: 
    $.keynav.goUp();
    break;
  case 39: 
    $.keynav.goRight();
    break;
  case 40: 
    $.keynav.goDown();
    break;
  case 13: 
    $.keynav.activate();
    break;
}
017Bluefield
  • 161
  • 2
  • 13
Roadrunner
  • 1,533
  • 2
  • 10
  • 7
  • 1
    The `key` variable in this `switch` is either `e.which` or `e.keyCode`. Those two are deprecated, so you should use `e.key` instead, which will also make your code more readable by turning those numbers into descriptive strings: `ArrayUp`, `ArrowRight`, `ArrowDown`, `ArrowLeft` and `Enter`. You can check out the key codes and identifiers for any key by just pressing them on this site: https://keyjs.dev – Danziger Sep 27 '20 at 07:43

9 Answers9

212

It's the Return or Enter key on keyboard.

Amir
  • 8,581
  • 7
  • 43
  • 47
JosephH
  • 8,177
  • 4
  • 32
  • 60
50

That would be the Enter key.

Cᴏʀʏ
  • 101,556
  • 20
  • 162
  • 188
39

Check an ASCII table.

It stands for CR, or Carriage Return, AKA the Return key.

Oded
  • 477,625
  • 97
  • 867
  • 998
  • 3
    I like this answer better than others because it shows HOW you knew that 13 was a carriage return. I found https://www.ascii-code.com/ easier to use. – Ryan Aug 20 '20 at 18:38
14

Keycode 13 is the Enter key

Which keycode for escape key with jQuery

Community
  • 1
  • 1
Brian Webster
  • 28,703
  • 48
  • 145
  • 221
12

The Enter key should have the keycode 13. Is it not working?

Sarwar Erfan
  • 17,864
  • 5
  • 44
  • 57
8

Keycode 13 means the Enter key.

If you would want to get more keycodes and what the key the key is, go to: https://keycode.info

darthvader1925
  • 231
  • 2
  • 6
5

key 13 keycode is for ENTER key.

Nagnath Mungade
  • 743
  • 7
  • 9
3

function myFunction(event) {
  var x = event.charCode;
  document.getElementById("demo").innerHTML = "The Unicode value is: " + x;
}
<p>Keycode 13 is: </p> 
<button>Enter</button>
<p>Press a key on the keyboard in the input field to get the Unicode character code of the pressed key.</p>
<b>You can test in below</b>

<input type="text" size="40" onkeypress="myFunction(event)">

<p id="demo"></p>

<p><strong>Note:</strong> The charCode property is not supported in IE8 and earlier versions.</p>
Apple Yellow
  • 187
  • 1
  • 1
  • 7
0

Working for me. Using "@testing-library/react": "^12.1.2"

  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/31636924) – jna May 03 '22 at 10:08