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
  • 40,311
  • 81
  • 251
  • 474

1 Answers1

3

Add this to the handler that shouldn't bubble:

e.stopPropagation()

assuming your handler takes an event parameter of e.

Evan Davis
  • 35,493
  • 6
  • 50
  • 57