CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: JavaScript

jQuery Plugin Template - With options

197 Views
Copy Code Show/Hide Line Numbers
 ;(function($){
    $.fn.pluginName = function(options) {
        var settings = $.extend($.fn.pluginName.defaults
            , options);
                
        return this.each(function(i, el) {
            // Do your stuff here.
        });
    };
 
    $.fn.pluginName.defaults = {
        // Default public options
    };
 
    // Put Internal Variables and Functions here
        
})(jQuery);
by jwwishart
  March 03, 2010 @ 3:12pm

by jwwishart    June 14, 2010 @ 3:02pm

Edited to have parameter of $ instead of verbose jQuery

by jwwishart    March 03, 2010 @ 3:29pm

Adjusted default options so that they are public... Allows altering of default options globally.

Add a comment


Report Abuse
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate