Home >Web Front-end >JS Tutorial >Several ways to execute Jquery after the page is loaded_jquery

Several ways to execute Jquery after the page is loaded_jquery

WBOY
WBOYOriginal
2016-05-16 16:55:29843browse

Method 1:

Copy code The code is as follows:

$(function(){

initPublish();

});

Explanation: initPublish() is the JS function you want to run; this code is placed at the bottom of the page.

Method 2:
Copy code The code is as follows:

$(document ).ready(function () {

// add your code here

initPublish();

$(.a).click( function (){

// add your code here

});

});

Method 3:
Copy code The code is as follows:

window.onload = function (){

// add your code here

}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn