Do something AFTER the page has loaded completely Do something AFTER the page has loaded completely javascript javascript

Do something AFTER the page has loaded completely


$(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    });});


That is the purpose of jQuery's .ready() event:

$(document).ready(function() {    if ( $('#abc').length ) //If checking if the element exists, use .length        alert("yes");});

Description: Specify a function to execute when the DOM is fully loaded.


Using the jQuery.ready should be enough. Try this

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

or

$(function(){});

which is a shortcut of the first.