Skip to content

Instantly share code, notes, and snippets.

@emjayess
Created January 18, 2011 23:34
Show Gist options
  • Save emjayess/785384 to your computer and use it in GitHub Desktop.
Save emjayess/785384 to your computer and use it in GitHub Desktop.
boilerplate js for jquery plugin authoring
// replace 'foo' with the name of the plugin, etc
(function($){
$.fn.foo = function(opts) {
var settings = $.extend({}, $.fn.foo.defaults, opts);
return this.each(function() {
var $this = $(this);
// plugin code here...
});
};
$.fn.foo.defaults = {
bar : "baz"
};
}(jQuery));
@emjayess
Copy link
Author

@emjayess
Copy link
Author

@emjayess
Copy link
Author

and now there's a website dedicated to jquery [plugin] boilerplate code!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment