Skip to content

Instantly share code, notes, and snippets.

@mishterk mishterk/jquery-closure-example.js Secret
Last active Oct 7, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.