jquery loaded async and ready function not working

后端 未结 6 1210
说谎
说谎 2021-01-14 02:40

In order to optimize the load of my document, I use to load jquery async like that



        
6条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-14 03:34

    jQuery, and all components that depend on jQuery (including Bootstrap), depend on hooking the DOMContentLoaded event to set up events.

    This means jQuery (and anything that uses $(function() {...})) must be downloaded before DOMContentLoaded fires, or it never hooks up its events.

    In turn, that means

提交回复
热议问题