/ Published in: jQuery

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// $(".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) };
Comments
