the pageLoad() and $(document).ready() events do the same. both methods seem too similar in simple example. but $(document).ready() and pageLoad() methods have very much differences in feture. I will explain differences between $(document).ready() and pageLoad() methods.
$(document).ready() JQuery’s document.ready() method gets called as soon as DOM is ready . If your web page has large images, it will not wait for loading of images completely. Hence it may called before pageLoad() method. We can have multiple document.ready() methods on a single web page which will be called in coming sequence.
pageLoad() method gets called when all resources of the page have been fully loaded. if you have large size images on web page then until all the images are not fully loaded on the page, pageLoad() method will not called. pageLoad() method is not browser compatible. We can have only one pageLoad() method on a single web page.
<script type="text/javascript"> function pageLoad() { $('#id').text('Working pageLoad'); } </script>
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
the pageLoad() and $(document).ready() events do the same.
both methods seem too similar in simple example.
but $(document).ready() and pageLoad() methods have very much differences in feture.
I will explain differences between $(document).ready() and pageLoad() methods.
$(document).ready()
JQuery’s document.ready() method gets called as soon as DOM is ready .
If your web page has large images, it will not wait for loading of images completely.
Hence it may called before pageLoad() method.
We can have multiple document.ready() methods on a single web page which will be called in coming sequence.
pageLoad() method gets called when all resources of the page have been fully loaded.
if you have large size images on web page then until all the images are not fully loaded on the page, pageLoad()
method will not called. pageLoad() method is not browser compatible. We can have only one pageLoad() method on a single web page.