JQuery stopPropagation on .live() when handlers already exist and are bound

后端 未结 3 1276
情深已故
情深已故 2021-01-27 07:21

I\'m aware that live calls bubble up through the doccument and that is why I\'m having issues.

Unfortunately I\'m using third party libraries that bind elements and wou

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-27 08:19

    U can use

    $("#outer").bind('click',function(e){
       alert("outer clicked"); 
    });
    $('#outer').on('click',"#inner",function(e){
        e.stopImmediatePropagation();
        alert("inner clicked"); 
    
    });
    

提交回复
热议问题