What jQuery event is called right after $(document).ready()?

前端 未结 8 970
囚心锁ツ
囚心锁ツ 2021-01-13 08:47

I have lots of HTML generated on $(document).ready(). I have a simple window system. But not only it is generated on $(document).ready() - also som

8条回答
  •  無奈伤痛
    2021-01-13 09:09

    By adding another handler function ones the document is ready, the handler will almost certainly be last one in the ready event queue. Effectively giving you an instant "post" ready handler function.

    $(document).ready(function() {
        $(document).ready(function() {
            // code to run "after" ready 
        });
    });
    

    $(document).ready

    When multiple functions are added via successive calls to this method, they run when the DOM is ready in the order in which they are added.

    Note that this will only work as long as no ones else uses this "trick".

提交回复
热议问题