$(document).ready() executes the code when all HTML elements have been loaded.
$(document).ready()
How to execute jQuery code after all of the CSS rules have been applied?<
$(window).load() fires after the whole page (images, CSS, etc.) has loaded.
$(window).load()
$(window).load(function() { // executes when complete page is fully loaded, including all frames, objects and images alert("window is loaded"); });