title: Adjusting jquery plugin to accept options?
body: <p>I'm using a jquery plugin that is supposed to accept options, but isn't for some reason. (Perhaps it was never finished?)</p>
  
  <p>The code is already set up to accept options, but it seems that the option object is simply not being passed through.</p>
  
  <p>Here is the plugin constructor:</p>
  
  <pre><code>$.fn.extend({ // extend jQuery.fn object
      pluginName: $.pluginName.construct
  });
  </code></pre>
  
  <p>Which calls: </p>
  
  <pre><code>     $.extend({
      pluginName: new function(options) {
          var defaults = {bla: 1};
          var options = $.extend(defaults, options);
                  ....
  
          this.construct = function() {
                      return this.each(function() {
                      .....
                   }
              }
       });
  </code></pre>
  
  <p>So, I made the following changes to the first bit of code:</p>
  
  <pre><code>$.fn.extend({ // extend jQuery.fn object
      pluginName: function(options) {
          return $.pluginName.construct(options);
      }
  });
  </code></pre>
  
  <p>Thinking it would be that easy. (I have never created a jquery plugin). However, it now gives me an error: </p>
  
  <pre><code> TypeError: 'undefined' is not a function (evaluating 'this.each')
  </code></pre>
  
  <p>I'm sure it's not correct since the .construct method does not take the options, but the "new function(options)" method does, and secondly, I probably need to pass $this somehow as well. </p>
  
  <p>Can anyone give me a hint on how to fix this? </p>
  
  <p>It should be callable like so:</p>
  
  <pre><code>$('#id').pluginName({first: true, blabla: "yes"});
  </code></pre>
  
  <p><strong>EDIT: My current changes to the plugin are available here: <a href="http://jsfiddle.net/fbF8w/" rel="nofollow">http://jsfiddle.net/fbF8w/</a>  - if anyone wants to take a closer look.</strong></p>
  
  <p>Edit: got it working. Nevermind guys. Thanks.</p>
  
  <p>Thanks,
  Wesley</p>