jQuery plugin: certain code should be called only once
<p>I am trying to write a jQuery plugin. For simplicity let's say that my code is</p>

<pre><code>$.fn.myplugin = function() {
  return this.each(function() {
    $('a.mypluginToken').live('click', function(){})
  }
}
</code></pre>

<p>As per above code every single time $('a').myplugin is called, a binding is done for 'click' event because of 'live'. I need that binding to be done only once and not for each element that invokes my plugin.</p>

<p>one solution is that after binding the click event I set a data on document saying 'binding_done'. And check for that data every single time. Even though that solution will work I am wondering if there is a better jQuery design pattern that I am missing.</p>

<p>Thanks.</p>

<p>I am using jQuery 1.4.2</p>
