Skip to content

Instantly share code, notes, and snippets.

@richellyitalo
Last active July 9, 2019 12:26
Show Gist options
  • Save richellyitalo/3f6d6349da4caf9a597930e6b2bd252c to your computer and use it in GitHub Desktop.
Save richellyitalo/3f6d6349da4caf9a597930e6b2bd252c to your computer and use it in GitHub Desktop.
// IIFE - Immediately Invoked Function Expression
(function(yourcode) {
// The global jQuery object is passed as a parameter
yourcode(window.jQuery, window, document);
}(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!
}
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment