Document Ready in jQuery

jQuery provides and easy way to run code only when the DOM is fully loaded and ready:

$( document ).ready(function() {
  // do stuff
});

Shorthand

You can also use this shorthand:

$(function() {
    // do stuff
});

Wait for the entire page

Use window instead of document to wait until the entire page is ready:

$( window ).load(function() {
    // do stuff
});
  Tweet It

🕵 Search Results

🔎 Searching...

Sponsored by #native_company# — Learn More
#native_title# #native_desc#
#native_cta#