After all $(document).ready() have run, is there an event for that?

后端 未结 6 1278
眼角桃花
眼角桃花 2020-12-04 19:15

I have a first.js file included in the page index.php that have something like this:

$(function(){

    $(\"#my_slider\").slider(\"value\", 10);

});
         


        
6条回答
  •  一个人的身影
    2020-12-04 19:23

    Based on Ian's answer I figured this out (tested - working):

    jQuery(document).ready(function() {
        jQuery(document).ready(function() {
            /* CODE HERE IS EXECUTED AS THE LAST .ready-CALLBACK */
        });
    });
    

    Of course this is because the ready callbacks are invoked in the order they where assigned. At the moment, when your outer ready callback is invoked, all other scripts should have their ready callbacks already assigned. So assigning your ready callback (the inner one) now will lead to yours being the last one.

提交回复
热议问题