Can I call $(document).ready() to re-activate all on load event handlers?

前端 未结 10 1577
情书的邮戳
情书的邮戳 2020-12-15 15:37

Does anyone happen to know IF and HOW I could re-call all on-load event handlers? I\'m referencing some .js files that I DON\'T have control over, and these .js libraries do

10条回答
  •  粉色の甜心
    2020-12-15 15:47

    You can do this simple.

    Make a function:

    function REinit() {
            /// PLACE HERE ALL YOUR DOC.READY SCRIPTS
    }
    

    Place just the Reinit() function inside doc.ready:

    $(document).ready(function(){
        REinit();
    });
    

    then after an ajax action just call

    REinit();
    

提交回复
热议问题