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

177
Vistas
Is it possible to trigger an onclick funciton of a child without triggering also its parents?

Hi,

I have this markup:

<div onclick="dothis();">
 <span><img src="icon.png"></span>
 <span>Click here to do this</span>
 <span>some stuff</span>
 <span onclick="close();">X</span>
</div>

the problem is that when I click the X to execute close(); it also executes dothis() which I dont want. I know I could just put the on click on the span containing click here but the thing is that the image and the span below are suppose to execute the function too when clicked and putting an onclick on each one would be redundant. You might say also that I could just wrap the first 3 elements in a new div and put the function there but that would conflict with the function itself (I dont say why because I dont want to drag it out too long).

How can I solve this without having to change the markup?

Thank you.

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