Skip to content

Instantly share code, notes, and snippets.

@zrobit
Created September 17, 2015 05:03
Show Gist options
  • Select an option

  • Save zrobit/bb934418304b9ccea903 to your computer and use it in GitHub Desktop.

Select an option

Save zrobit/bb934418304b9ccea903 to your computer and use it in GitHub Desktop.
jquery initial, best practice
// IIFE - Immediately Invoked Function Expression
(function($, window, document) {
// The $ is now locally scoped
// Listen for the jQuery ready event on the document
$(function() {
// The DOM is ready!
});
// The rest of the code goes here!
}(window.jQuery, window, document));
// The global jQuery object is passed as a parameter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment