JavaScript - How do I make sure a jQuery is loaded?

后端 未结 5 608
野趣味
野趣味 2020-12-02 13:45

I have a web page. When this web page is loaded, I want to execute some JavaScript. This JavaScript uses JQuery. However, it appears that when the page is loaded, the jQuery

5条回答
  •  有刺的猬
    2020-12-02 14:23

    When a browser encounters a script element it blocks which means that as long as you have a script element that loads jQuery before any script that wants to use jQuery, you should be fine, e.g.

    
    
    

    See JavaScript Load Order for some additional commentary on this topic.

提交回复
热议问题