Jquery Remove All Event Handlers Inside Element

后端 未结 3 512
臣服心动
臣服心动 2020-12-10 00:43

I have a div element with several elements inside it like buttons and so forth which have event handlers attached to them. I know its possible to go:

$(\"#bu         


        
3条回答
  •  -上瘾入骨i
    2020-12-10 01:25

    jQuery will do the looping for you for just the direct children:

    $("#div1").children().off();
    

    or if you want all descendants:

    $("#div1").find("*").off();
    

提交回复
热议问题