Ready and onload

Source: Internet
Author: User

The Ready:jquery method executes when the DOM is loaded in readiness. (not including pictures and other non-text media files)

It can greatly improve the responsiveness of Web applications.

There is a parameter--a reference to the jquery function--is passed to the ready event handler. You can give this parameter any name, and you can safely use the $ alias without worrying about naming conflicts.

Make sure that no function is registered in the OnLoad event of the <body> element, otherwise the +$ (document). Ready () event is not triggered.

You can use the $ (document). Ready () event indefinitely on the same page. The functions that are registered are executed sequentially in order (in the code).

There can be more than one, the program executes sequentially

Onload:js method, the OnLoad event occurs immediately after the page or image has finished loading. And only one is allowed to exist;

You can choose according to what you want to load: There are pictures and other non-text media placed in the onload loading, the other can be loaded in ready;

Ready and onload

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.