title: jQuery Plugin: Add method with .each
body: <p>I have the following code in a jQuery plugin:</p>
  
  <pre><code>$.fn.myForm = function() {
      return this.each(function() {
          var myForm = new MyForm(this);
  
          $.data(myForm, 'myForm');
      });
  };
  </code></pre>
  
  <p>I thought that doing this, would allow me to then access the inner functions of <code>myForm</code>, such as <code>getForm</code></p>
  
  <pre><code>var MyForm = function() {
     //...
     function getForm() {
         return 'Hi';
     }
  }
  </code></pre>
  
  <p>But when I try to access <code>myForm</code> from outside the plugin, I get <code>undefined</code>:</p>
  
  <pre><code>$('#test').myForm();
  $('#test').data('myForm')
  &gt; undefined
  </code></pre>
  
  <p>What am I doing wrong here?</p>