1

In my html code, I have a td tag that has an onclick event, and inside the td tag is an image tag that also has an onclick event. The problem is when I click the image, both its onclick and the td tag's onclick event occurs. How can I set it so that if I click the image tag, the td onclick event does not happen?

Note: It should work with IE8 and higher.

Thanks

omega
  • 35,693
  • 74
  • 215
  • 425

1 Answers1

3

Add this to the handler that shouldn't bubble:

e.stopPropagation()

assuming your handler takes an event parameter of e.

Mathletics
  • 33,673
  • 6
  • 49
  • 57