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

144
Vistas
How do I get pressing the enter key to stop being treated like a mouse click in javascript?

I have a program where I have several clickable buttons as well as a reason to click enter. Issue is, if I click a handful of the buttons with the mouse and then click the enter key on my keyboard, it does what enter should do and it also acts as though I had clicked the last button that I clicked one more time. I want the clicking to only be done with the mouse and have the enter key not be able to click buttons. How do I do this? code Here is how I am currently making the buttons clickable and getting the input of the keyboard.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

By clicking on the tile button, it gets focus. Hence, subsequent enter triggers the button.

You could "un-focus" the button:

// tile is a reference to the button, as per your question
tile.addEventListener('click', (evt) => {
  // un-focus
  tile.blur();
  // do some stuff
});
about 4 years ago · Juan Pablo Isaza Denunciar
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