Do something AFTER the page has loaded completely

前端 未结 8 683
日久生厌
日久生厌 2020-12-08 20:41

I\'m using some embed codes that insert HTML to the page dynamically and since I have to modify that dynamically inserted HTML, I want a jquery function to wait until the pa

相关标签:
8条回答
  • 2020-12-08 21:36
    $(window).load(function () {
        ....
    });
    

    If you have to wait for an iframe (and don't care about the assets, just the DOM) - try this:

    $(document).ready(function() { 
        $('iframe').load(function() { 
           // do something
        });
    });
    
    0 讨论(0)
  • 2020-12-08 21:36

    Using the jQuery.ready should be enough. Try this

    $(document).ready(function(){
       //your code here
    });
    

    or

    $(function(){
    
    });
    

    which is a shortcut of the first.

    0 讨论(0)
提交回复
热议问题