Jquery knowledge point 1. Differences between Jquery ready and Dom onload _ jquery

Source: Internet
Author: User
Onload indicates that all dom elements have been created, after the image and css are added, ready is triggered after the dom element is created. Therefore, jquery ready can improve the webpage response speed;
Jquery: ready standard syntax:

The Code is as follows:


$ (Document). ready (function (){
Alert ("loading ended ");
});


A $ (document) converts the document of a dom object to a jquery object, and then calls the jquery method ready (). Because dom objects cannot call jquery methods, although their relationship is very close;
Jquery: short form of ready:

The Code is as follows:


$ (Function (){
Alert ("loading ended ");
});


A major role of the ready function is to register events for dom objects:

The Code is as follows:






Related Article

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.