Jquery - if page loaded

后端 未结 9 1766
[愿得一人]
[愿得一人] 2021-02-05 15:57

Is there any trick how to start a function in javascript, which starts when the page is completely loaded?

9条回答
  •  遇见更好的自我
    2021-02-05 16:35

    You are looking for the window load event.

    In jQuery you attach the load event as follows:

    $(document).ready(function() {
    
      $(window).load(function() {
    
      }
    
    }
    

    Note that you need to place this inside a document ready for some browsers, IE8 OTTOMH.

提交回复
热议问题