This is the built-in function of jquery, meaning that the Web page will be executed after it has been loaded, and this is the same as the original javascript: Window.onload=function () {//Execute function} is equivalent to $ (document). Ready (function () {}) or: <body onload= "XXX" >
(function ($) {...}) (JQuery);
Here is actually an anonymous function, as follows:
Function (ARG) {...}
This defines an anonymous function with a parameter of ARG
When calling a function, the parentheses and arguments are written after the function, and because of the precedence of the operator, the function itself needs parentheses, namely:
(function (ARG) {...}) (param)
This is equivalent to defining an anonymous function with a parameter of ARG, and calling this anonymous function as a parameter param
and (function ($) {...}) (jquery) is the same, the reason why only use $ in formal parameters is to not conflict with other libraries, so the argument with JQuery
Equivalent to funtion output (s) {...};output (jQuery), or Var fn=function (s) {...}; FN (jQuery);
$ (function () {...});
Or:
JQuery (function ($) {
...
});
Allows you to bind a function that executes after the document is loaded in the DOM (not including the picture). This function acts as a $ (document). Ready (), except that when you use this function, you need to wrap all the $ () operators in the page that need to be executed when the DOM is loaded. Technically, this function is a link-but there is not much that is actually linked in this way.
Full Write is:
$ (document). Ready (function () {
...
});
The difference between $ (function () and (function ($) in jquery is explained in detail