jquery is an excellent javascrīpt framework. Let's now discuss the functions that are executed after two pages are loaded in Jquery.
$ (document). Ready (function () {
Write your code here ...
); Code that runs when the DOM load completes
Can be written by Jane
JQuery (function () {
});
(function ($) {}) What do you mean by (jQuery)?
(function () {
}) (JQuery);
It actually executes the () (para) anonymous method, except that it passes the jquery object.
Equivalent
function AA ($) {}
AA (JQuery)
is an idiomatic way to initialize a jquery object.
The popular point is that the page is loaded after the completion of the code you need to execute.
But this thing, sometimes will make the page beat, a lot of jquery plug-ins are loaded after the completion of the change in style, the page will have the feeling of beating or flashing. For example Ui.tab this plugin, page element a lot, all show out, it just form tab, very Dizzy said
(Funtion () {}) (); Execute the function immediately; the equivalent of declaring a function, calling directly after the declaration is finished;
If the parameter is as follows:
(Funtion (str) {alert (str)}) ("Output")) ; equivalent to: funtion outputfun (str) {alert (str);};o Utputfun ("Output");
JQuery (function () {}), the code that holds the operation Dom object, and the DOM object already exists when the code is executed. cannot be used to store the development plug-in code, because the jquery object is not passed, the external through the Jquery.method can not call the method (function).
(function () {}) (jQuery); code that holds the development plug-in, the DOM does not necessarily exist when the code is executed, so be careful with the code that performs the DOM operation directly.