document ready function when to use code example
Example 1: jquery document ready
// jQuery document ready
$(document).ready(function() {
});
Example 2: (function (g, d, a) {})(window, document, jQuery);
;( // <---------------+
// | encapsulate the function
function($, window, document) { // <--+ declare | and call it passing three
// | anonymous | arguments.
} // <--+ function |
// |
)(jQuery, window, document); // <---------------+