I'm new to jQuery plugin development and I'm interesting to know, about what's difference between two ways listed below? And what's the right way to do this?
(function($){
$.myplugin = {
// plugin code
};
})(jQuery);
And the second one:
(function($){
$.fn.myPlugin = function() {
// plugin code
};
})(jQuery);