How to execute jQuery code after the browser window is completely loaded?

Most of the times while writing jQuery code, we don't wait for window.onload event. Due to this reason we are using ready(), which will run before total window will load, but DOM should be ready for traversed and manipulate.

But some times we need to wait until the complete page is ready including all assets of the web page. For this one we have to use load event handler to the window object. Below example will show, how to use in window.onload event in JQuery. This is also a JQuery Interview Question.

<script type="text/javascript">
jQuery(window).load(function(){ alert('this will call after the window will load completely'); });
</script>

Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

 
Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar