'How to get all multiple keys pressed in javascript?
i found this jsfiddle, that should show all keys pressed on the keyboard. The code looks fine, but it does not seem to work, at least on my keyboard: https://jsfiddle.net/HwR9N/3/
When i press all the arrow keys, only two of the keys get listed.
I work with a similar code, to create a javascript game, but i got the same problem there:
//List of all keys pressed or up
var keymap = [];
window.addEventListener("keydown",
function(e){
keymap[e.keyCode] = true;
checkCombinations(e);
},
false);
window.addEventListener('keyup',
function(e){
keymap[e.keyCode] = false;
},
false);
A strange thing is, that the WASD keys work all at the same time. Does anybody know a different method, that works on every keyboard? I haven't tried another keyboard yet. Im working on a HP Laptop. OS is Windows 10. Problem occurs in Chrome and Firefox.
Im thankfull for any advice.
Greets, Florian
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
