Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Difference between document.ready and window.onload

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 140
    Comment on it

    window.onload() - It is a Java script pre-defined function.

    document.ready() It is a jQuery event which are called when page is loaded.


    The basic difference between these :-


    document.ready() is called after the DOM is loaded without waiting for all the contents to get loaded.But other side window.onload() function waits until the all contents of page is loaded.


    Example:- Suppose there is large image on a page, until that image is not loaded completely window.onload() will wait till then in such case.
    But the document.ready() will not wait until the image is loaded.

    This is the reason for window.onload() function the execution will be slow in compare to using document.ready over there in place of window.load.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: