Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

258
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda