jquery and JS initialize the difference in loading pages:
jquery: Waiting for the page to finish loading data, and part of the page elements (excluding pictures, videos),
JS: Is the page full load complete before performing initialization loading.
1, jQuery page load initialization method There are 3 kinds, the page will be loaded when the script executes,
The first (more commonly used):
Copy Code code as follows:
$.function () {
Alert ("First method");
});
The second type:
Copy Code code as follows:
$ (document). Ready (function () {
Alert ("second method");
});
The third type:
Copy Code code as follows:
JQuery (function ($) {
Alert ("Third method");
});
2, JS initialization of the loading method
First type:
Copy Code code as follows:
Window.onload=function () {
Alert ("Initialize load");
};
The second type:
(Winonload this method name customization)
Copy Code code as follows:
function Winonload () {
Alert ("Initialize load");
};
Winonload ();
Note: Because jquery uses the $ symbol, and some components such as dwr have conflicts, in order to solve this problem, you can use the
Copy Code code as follows:
var ace=jquery.noconflict ();