Created
April 4, 2012 21:02
-
-
Save icodejs/2305627 to your computer and use it in GitHub Desktop.
Global functions and plugin methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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