Return to Snippet

Revision: 23118
at January 31, 2010 00:06 by delikassap


Initial Code
// $(".someclass").newMethod();

(function ($) {
  $.fn.newMethod = function () {
    return this.each(function () {
      alert(this);
    });
  };
})(jQuery);




// usage : $(".someclass").newMethod({ opt1: value1 , opt2 = 'value2' });

(function($){
 $.fn.methodName = function(options) {

  var defaults = {
   opt1 : value1,
   opt2 : "value2"
  };
  var options = $.extend(defaults, options);
    
  return this.each(function() {

  });
 };
})(jQuery);



//usage $.log('message is logged');

jQuery.log = function(message) {
   alert(message)
};

Initial URL

                                

Initial Description

                                

Initial Title
Jquery Plugin Structure

Initial Tags
plugin, jquery

Initial Language
jQuery