I have the following structure :
<li onclick='GetMyTopic({1});' class='SideBarBoxli SideBarBoxLiSelected' id='MyTopics{0}'>
<div style='float:right; padding-top:3px;'><a href='{0}'> <span>{1}</span></a></div>
<div > <a id='img{2}' onclick='DeleteTopic({0},{1})' href='#'> <img src='../../../images/delete.png' height='16' width='16'/></a></div>
</li>
When I click the img Delete of the first span, the li click is also invoked.
I just want when I click delete img the delete img script only gets invoked and not the li. same for the span element.
Thanks.
In that case, add a return false
, eg:
DeleteTopic({0},{1}); return false;
This will stop the click
event from bubbling up to the <li>
element, triggering its handler as well.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.