简体   繁体   中英

child action doesn't trigger parent jquery

I have couple <a> within a parent div which will perform a specific action when clicked. How can I make it so that when user clicks each <a href="xxxx"> , user will only get linked to other pages and the parent function will not be triggered?

Stop the click event from bubbling up to the parent, like so:

$("a").click(function(e) {
    e.stopPropagation();
});

See event.stopPropagation

Demo.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM