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

174
Vistas
DevTools Programmatically input text and trigger keypress, keydown, keyup events

In DevTools, I am trying to programmatically populate a login form (as an experiment into personal time-saving dev techniques).

The input form is on the screen, and in DevTools I can populate the input field like this:

document.getElementsByTagName('input').item(0).value = "myLoginID";

But this doesn't trigger the keypress/keydown/keyup events that React needs to set the state variable.

How would I do that (trigger those events)?

I tried this, but nothing appeared in the input field:

document.getElementsByTagName('input').item(0).dispatchEvent(new KeyboardEvent('keypress', {'key': 'm'}));

References:

MDN HTMLCollection.item

Trigger a keypress/keydown/keyup event in JS

Chrome Developer Tutorial on Debugging JavaScript

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