The difference between jquery and js initial loading of the page:
jquery: wait for the page to load the data and some elements of the page (excluding pictures and videos),
js: wait for the page to be fully loaded before executing the initial loading.
1. There are three ways to initialize jQuery page loading. The script will be executed when the page is loaded.
The first (more commonly used):
$.function(){
alert("First method");
});
Second type:
$(document).ready(function(){
alert("Second method");
});
Third method:
jQuery(function($){
alert(" Three methods");
});
2. Method of js initialization loading
The first method:
window.onload=function(){
alert("Initial load");
};
Second type:
(winOnload this method name is customized)
function winOnload() {
alert("Initial load");
};
winOnload();
Note: Due to jquery Using the $ symbol conflicts with some components such as dwr. In order to solve this problem, you can use
var ace=jQuery.noConflict();