The One Of Rowlet
The One Of Rowlet

Reputation: 9

JS keycodes not the same as websites say?

When I look onto any website that shows JS keycodes, I see that the f# buttons are 112-123, and that 's' is 83. However, I made my website console.log() the keycode of the key I press, and 's' came up as 115. The f# keys don't show up at all. Can someone please help?

Code is just

body.addEventListener('keypress', function() {
   var x = event.keyCode;
   console.log(x);
});

Upvotes: 0

Views: 39

Answers (1)

Jay Buckman
Jay Buckman

Reputation: 578

You need to consider upper and lower case. S is 83. s is 115.

Upvotes: 1

Related Questions