Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

261
Views
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

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!