javascript [removed] tag - code execution before src download

后端 未结 4 1634
南方客
南方客 2020-12-12 08:35

In this snippet


Lets assume th

4条回答
  •  旧巷少年郎
    2020-12-12 08:52

    If you had the below code and didn't want your alert('hi') to fire until all scripts have downloaded, you can wait for the document ready event. You can do this using jQuery, or with vanilla JavaScript.

    
    
    

    To defer until all scripts have loaded using jQuery:

    $( document ).ready( function () { 
        alert('hi');
    });
    

提交回复
热议问题