[SOLVED] When creating a plugin, how do you make it so you can call it with more than one config

[SOLVED] When creating a plugin, how do you make it so you can call it with more than one config

I'm currently creating a plugin that you call on elements and it modifies the elements in some way. What I'm trying to do is make it so that you can call it more than once on different elements, each with their own config and options.

So far, my plugin works great on one element, but the next time I call it on an element, both of the elements use the second one's config.

I'm wondering what exactly in the plugin allows this to happen. Here's some of the code:

  1. (function($) {
  2.   _jCInit = true;
  3.   $.jClone = {
  4.     defaults: {
  5.       <defaults are in here>
  6.     }
  7.   }
  8.   $.fn.extend({
  9.     jClone:function(config, options){
  10.       var config = $.extend({}, $.jClone.defaults, config);
  11.  
  12.       <main code in here>
  13.     }
  14.   });
  15. })(jQuery);

Did I write all of this right or did I miss some stuff?

I followed several tutorials and all of them seemed to have different ways of setting up the plugin.

One thing that I thought might have something to do with it was this:
  1. return this.each(function() {  

  2.  }); 
I'm still new to jQuery, so go easy on me if my code is completely fudged up.