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

后端 未结 5 631
野趣味
野趣味 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:11

    In general, you just use the following basic "document loaded" test in jquery. Straight from the beginners jquery tutorial:

     $(document).ready(function() {
       // do stuff when DOM is ready
     });
    

    I can think of any reason why this should not work, there are certainly millions of sites using jquery that relies on precisely this bit of code.

提交回复
热议问题