Several ways Jquery executes after a page loads


Method 1:


$(function(){

initPublish();

});

InitPublish () is the JS function you want to run. This code is at the bottom of the page.

Method 2:


$(document).ready(function () {

// add your code here

initPublish();

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

// add your code here

});

});

Method 3:


window.onload = function (){

// add your code here

}