According to the jQuery plugin authoring guidelines, a basic plugin structure would look like this:
(function($){
$.fn.myPlugin = function( options ) {
return this.each(function() {
// Do something...
});
};
})( jQuery );
Yet I've seen the following pattern in several jQuery plugins I've inspected:
(function($){
$.extend($.fn, {
myPlugin: function( options ) {
$(this).each( function() {
// Do something
});
},
})
})(jQuery);
Can someone explain the second approach- What is $.extend(...
and the object-notation all about?
Thanks-