Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

145
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!