Difference between window.onload and $(document).redy
Pranay Rana
Select an image from your device to upload
window.onloadCode in this method get executed when DOM tree is ready.But fact is code in this method executed when DOM tree is ready and All the external resource are load like Images, Flash vidoe or quicktime video.Loading of the external resources deplay execution of the actual script when page get displayed.
$(document).redyCode in this method get executed once DOM tree loading is done.That means its not wait for the external resource get loaded. And run the javascript code which is in function.
So if you use Windows.onload than end user have to wait to see expected behaviour till DOM tree and external resouce get loaded by the browser. Where as in case of $(document).redy script get exeucuted once Dom tree loaded by browser.