Skip to content

Instantly share code, notes, and snippets.

@icodejs
Created April 4, 2012 21:02
Show Gist options
  • Save icodejs/2305627 to your computer and use it in GitHub Desktop.
Save icodejs/2305627 to your computer and use it in GitHub Desktop.
Global functions and plugin methods
jQuery.extend({
myFunction: function (){
// jqglobal => Tab
// this will add a global function that that can be accessed via the dollar sign does not work on elements
// e.g. jquery.myFunction()
}
});
jQuery.fn.extend({
myFunction: function () {
// jqplugin => Tab
// this is called a 'method' and is called on an element.
// jquery('.elemtent').myFunction()
return this.each(function(){
var current_elem = jquery(this);
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment