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

229
Views
Prevent parent been clickable while child clicked -not bubbeling issue

I have a grandfather div which is contain 200 "father" divs (and 200 child1 and 200 child2). I want to target "child2" element while clicking on it by create only 1 eventlistener to the "grandfather" and so "child2" element is

event.target.parentElement.lastChild

While clicking twice. Each click on 1 different child2 element i need to stop eventlistener from been active for 2 seconds.

<div class="grandfather">
   <div class="father"> 
         <div class="child1"> </div>
         <div class="child2"> </div>
   </div>
</div>
document.queryselector(".grandfather").addEventListener("click",foo(e))

function foo(e){
if(e.target.parentElement.lastChild){
   // Check if 2 elements been clicked
   // Stop eventlistener for sec
}

I thought its relly to buubling but e.stopPropagation() and e.preventDefault() not working.

about 4 years ago · Juan Pablo Isaza
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!