title: jQuery trigger to fire function only once
body: <p>Scenario:
  Using jQuery multiple binds are done for a specific event. When event is triggered specified function should fire once PER trigger.</p>
  
  <p>Challenge:
  The way jQuery trigger works is that when trigger is called the associated function is fired same number of times as number of binds that event has. On EACH trigger the function should be fired only once. How can this be achieved. "one" does not work in the scenario because the function should be fired each time the event is triggered. </p>
  
  <p>Thanks in advance.</p>
  
  <p>UPDATE:
  Apologize for not being more specific.</p>
  
  <p>The requirement is that when page loads, different elements on the page to register so when a custom event occurs they will participate in it. </p>
  
  <p>When the the custom event is triggered/raised, a function is to be called that will perform some task on the all the registered elements.</p>
  
  <p>Eg.
  Please note, the elements embedded from different Partial Views (MVC). </p>
  
  <pre><code>&lt;html&gt;
  &lt;a href="#" id="triggerelement"&gt;Trigger element&lt;/a&gt;
  &lt;div id="element1" data-join="aevent"&gt;something 1&lt;/div&gt;
  &lt;div id="element2" data-join="aevent"&gt;something 2&lt;/div&gt;
  &lt;div id="element3" data-join="aevent"&gt;something 3&lt;/div&gt;
  &lt;div id="element4" data-join="aevent"&gt;something 4&lt;/div&gt;
  &lt;/html&gt;
  </code></pre>
  
  <ol>
  <li>On document ready -
  all elements with "data-join" to bind to event "aevent".</li>
  <li>When trigger("aevent") is called the binding function should collect all elements that have to participate in "aevent" and perform some manipulation on them.</li>
  </ol>
  
  <p>Two issues I am running into: </p>
  
  <ol>
  <li><p>What element to "bind" to - $(?).bind. Reason: Multiple elements can raise this custom event and elements raising the event would/should not be known. One thought was - $(document).bind/$(document).trigger. Is this is the best approach?</p></li>
  <li><p>Using jQuery when $().trigger is called how can I ensure that it invokes the associated function only <strong>once per call</strong> rather than for each element bound to that event.</p></li>
  </ol>