Window.onload and $ (doucument). Read () Differences

Source: Internet
Author: User

Execution Time:

Window.onload: You must wait for the page to complete after all content has been loaded (including pictures) to execute

$ (document). Ready (): All DOM structures in a Web page are executed after they have been drawn, and things that might be associated with the DOM element are not loaded

number of writes :

window.onload: Cannot write multiple at the same time, there can be only one window.onload method

Window.onload = function () {alert ("Test");}

$ (document). Ready (): Ability to write multiple

$ (document). Ready (function () {alert (test);});

Simplified notation:

Window.onload: None

$ (document). Ready ():

$ (function () {alert (test);});




Window.onload and $ (doucument). Read () Differences

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.