Skip to content

Instantly share code, notes, and snippets.

@mishterk
Last active October 7, 2019 00:03
Show Gist options
  • Save mishterk/aca2cd354521a70e38ca54282b2f8c20 to your computer and use it in GitHub Desktop.
Save mishterk/aca2cd354521a70e38ca54282b2f8c20 to your computer and use it in GitHub Desktop.
A jQuery closure for basic encapsulation. For more info, see https://philkurth.com.au/tips/use-closures-for-basic-encapsulation-when-writing-jquery/
(function ($, window, document, undefined)
{
// Write your jQuery here. Any JavaScript you write in here
// is scoped so you don't have to worry about symbol names
// clashing with each other.
// You can define functions in here that are only available
// in this scope.
function my_scoped_function(){ /* … */ }
})(jQuery, window, document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment