How to cancel click event of container div trigger when click elements which inside container in JQuery?

后端 未结 3 1917
终归单人心
终归单人心 2021-01-12 02:32

E.g

I am not fire when click me
$(\'.container\').click(function(){
3条回答
  •  误落风尘
    2021-01-12 03:08

    $('.inside').click(function(e) {
        e.stopPropagation();
    });
    

    That should work for you. It stops any click in the inside div from bubbling up to the container.

    Here's a quick example as well - http://jsfiddle.net/Yf8Ra/1/

提交回复
热议问题