Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

236
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda