Best way to define custom jQuery object properties?
<p>I want <code>myproperty</code> to be able to be accessed from other methods within Foo.</p>

<p>Here is the way I'm doing it now:</p>

<pre><code>(function($){
  $.fn.Foo = {

    main: function(){
      return this.each(function(){  

        this.myproperty = 'abc';

        ...
        ...bind('click', 'somemethod')...
        ...

      });
    }

    somemethod: function(e){

      // access here myproperty
      alert($.fn.Foo.myproperty); 
    }

}(jQuery));

(function($){
  $.fn.extend({ Foo : $.fn.Foo.main});
}(jQuery));
</code></pre>

<p>and seems to work. But is this the best way to do it? Are there any other ways?</p>
