Shorthand for $(document).ready() in jQuery.

vishalneeraj-24503
Posted by vishalneeraj-24503 under jQuery category on | Points: 40 | Views : 341
//Original
$(document).ready(function() 
{
alert("Hello");
});



//Shorthand for $(document).ready()
$(function() 
{
alert("Hello");
});


$(document).ready() will only run once the page Document Object Model (DOM) is ready for JavaScript code to execute.
Code included inside $(window).load(function() { ... }) will run once the entire page (images or iframes),not just the DOM.

Comments or Responses

Login to post response