Novice contact JavaScript, jquery when the inevitable to contact the topic identified with the relevant content, repeatedly read a few times to use the time is always not practical, write this article to remember.
The symbol "$" is a jquery object (the individual understands this and has the use of the function). Then we know that the following equation is fully functional and consistent in performance.
$ (function () {/*do some thing*/}) = $ (document). Ready (function () {/* do some thing/}) = $ (). Ready (function () {/* do some Thing */});
There's something in jquery, and then next, there are window.onload and <body onload= "" > Two in native JavaScript, and there's a certain difference between using anonymous functions and not anonymous functions. I do not use it for the time being, so I did not do the experiment, the Internet is not consistent. But the onload is different from the ready in jquery, which says:
One is the number of different times, $ (). Ready () can be used multiple times in one HTML, the onload can only be used once, or the valid binding can only be the only one.
The other is the timing of the execution, simply saying that the time to execute is earlier than the onload, since $ () is executed as soon as the DOM tree is loaded, and the onload completes the execution with all the elements loaded.
The above is a small set to introduce the $ (function) ready and onload difference introduction, hope to help everyone, if you have any questions welcome to my message, small series will promptly reply to everyone, here also thank you for the cloud Habitat Community support site!