154

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,623
  • 2
  • 11
  • 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

223

It's the Return or Enter key on keyboard.

Amir
  • 8,821
  • 7
  • 44
  • 48
JosephH
  • 8,465
  • 4
  • 34
  • 62
54

That would be the Enter key.

Cᴏʀʏ
  • 105,112
  • 20
  • 162
  • 194
40

Check an ASCII table.

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

Oded
  • 489,969
  • 99
  • 883
  • 1,009
  • 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
  • 30,033
  • 48
  • 152
  • 225
12

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

Sarwar Erfan
  • 18,034
  • 5
  • 46
  • 57
11

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
  • 261
  • 2
  • 8
6

key 13 keycode is for ENTER key.

Nagnath Mungade
  • 921
  • 10
  • 11
2

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
  • 307
  • 1
  • 2
  • 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