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
});
✖ Clear

🕵 Search Results

🔎 Searching...