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

141
Vistas
can we dispatch a KeyboardEvent of press & hold of a keyboard key?

how can i dispatch a KeyboardEvent in window of pressing a keyboard key ? in javascript ? i have scenario in which user press and hold a specific keyboard button and then drag the mouse on screen it will draw a box , but i want to press that specific button programmatically on load of document , so whenever user will clickdown and drag mouse it will draw , is this possible ?

what is have a this keydown but its not working

 window.dispatchEvent(new KeyboardEvent('keydown', {
    'key': 'control'
}));
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It's a tiny bit trickier to do the "mousedown" than, for example, onlick. Here's what I'm using:

$('div').on('mousedown mouseup', function mouseState(a) {
    if (a.type == "mousedown") {
        //whatever you like
    }
});

Tell me if it helped :D

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