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

140
Vistas
Can you chain overlapping click events in JS?

I was wondering whether it is possible to chain overlapping onClick events without passing anything down to the children.

I know I could just pass things down the tree and have a single function but I'm just experimenting

 <div onClick={()=> foo("a")} >
   <div onClick={()=> foo("b")} />
 </div>

what I want is receive the 2 events together in a listener function like:

listener = (events) => {
  console.log(events) // something like [[Event("a"), Event("B")], ......]
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

there's an "Event bubbling" concept. div inside another div and they both have a click listener for example, when you click the inner one you're basically clicking the outer one too. you can manage this behavior with 3rd argument of the addEventLister function, and also from inside the callback, e.stopPropagation()

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