admin管理员组

文章数量:1131246

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;
}

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;
}
Share Improve this question edited Jun 19, 2014 at 22:26 017Bluefield 1612 silver badges13 bronze badges asked May 22, 2011 at 7:42 RoadrunnerRoadrunner 1,7432 gold badges11 silver badges7 bronze badges 1
  • 2 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: keyjs.dev – Danziger Commented Sep 27, 2020 at 7:43
Add a comment  | 

9 Answers 9

Reset to default 235

It's the Return or Enter key on keyboard.

That would be the Enter key.

Check an ASCII table.

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

Keycode 13 is the Enter key

Which keycode for escape key with jQuery

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

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

key 13 keycode is for ENTER key.

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>

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

本文标签: javascriptkeycode 13 is for which keyStack Overflow