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

208
Vistas
HTML Form enter press is keydown instead of keyup/keypress, enabling spam

When using <form> tags, it has a built-in behavior for enter key, which runs the submit. They decided to make it using keydown, so it creates spam issues. For example if I had a form for a todo list, and i hold the enter key then it will spam create the same todo-item. I want it to be keyup or keypress instead of keydown, I would still like enter key to submit rather than getting rid of it all together. Using blur() also doesnt work since it doesnt focus on the button in the first place.

<form>
    <label>username
        <input type="text" />
    </label>
    <label>password
        <input type="text" />
    </label>
    <button type="submit">Login</button>
</form>
document.querySelector("form").addEventListener("submit", event => {
    event.preventDefault();
    console.log( "submitted" );
})
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