Skip to content

Instantly share code, notes, and snippets.

@jethrolarson
Created March 18, 2010 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jethrolarson/336712 to your computer and use it in GitHub Desktop.
Save jethrolarson/336712 to your computer and use it in GitHub Desktop.
//: Turn any function into a jQuery method
$.plug = function(name,func){
$[name]=func;
};
//: Turn any function into a jQuery plugin
$.fnPlug = function(name,func){
$.fn[name] = function(){
var args = arguments;
return self.each(function(){
func.apply(this,args);
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment