How can I prevent an event from bubbling up to parent in javascript?
Eg.
<tr id="my_tr" onclick="javascript:my_tr_click();">
<td>
<a id="my_atag" href="javascript:void(0);" onclick="javascript:my_a_click();">Delete</a>
<td>
</tr>
When I click on "Delete" anchor tag, first the my_a_click() function gets called, and then the parent tr onclick function - my_tr_click() - gets called. This, I believe, is called event propagation.
How can I stop that my_tr_click() function from getting called when I click on the child anchor tag?
Please help me out..
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…