Jquery ready (FN) page loading Function

Source: Internet
Author: User
Ready (FN) binds a function to be executed when the Dom is loaded and can be queried and manipulated. This is the most important function in the event module, because it can greatly improve web applications. Program .
Simply put, this method is purely an alternative to registering an event with the window. Load event. By using this method, you can call the function you bind immediately when the Dom is ready to read and manipulate, and 99.99% of JavaScript functions need to be executed at that moment.
There is a parameter -- a reference to the jquery function -- passed to this ready event processing function. You can give this parameter any name, so you can use the $ alias without worrying about name conflicts. Make sure that the function is not registered in the onload event of the <body> element. Otherwise, the $ (document). Ready () event is not triggered. You can use the $ (document). Ready () event infinitely on the same page. The registered functions follow ( Code Is executed sequentially.
Returned value: jquery
Parameters:
FN (function ): Function to be executed when the Dom is ready
Example:
The code that runs when the Dom is loaded can be written as follows:
Jquery code:
$ (Document). Ready (function (){
// Write your code here...
});
Bytes ---------------------------------------------------------------------------------------------------------
Use the abbreviation $ (document). Ready (), while the internal jquery code still uses $ as the alias, regardless of the global $.
Jquery code:
Jquery (function ($ ){
// You can continue to use $ as an alias here...
});

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.