title: YUI Listener set on startup lost
body: <p>I'm trying to monitor the clicks on a web page that is written in YUI2.
  The events seem to be getting wiped away and the callback function isn't getting called.</p>
  
  <p>The links that I am trying to monitor are all of class 'action-link', but none have an id set on the page.  I tried calling YAHOO.util.Event.addListener() first with the actual element, but that didn't work.  Next I tried adding an id to each of the element and then calling it, but that still didn't work.</p>
  
  <p>But using the JS debugger, I see that the element id's have been added to all of the links.  But the Listeners are not set.  In the debugger, I can call YAHOO.util.Event.getListeners() on the various links and see that they are all null.  Yet, in the debugger I can manually call YAHOO.util.Event.addListener(elementIDString, "click", fnCallback) and then clicking on the link causes the callback to be entered.</p>
  
  <pre><code>function fnCallback(e) {
    alert("click event: " + e.currentTarget.title);
  }
  
  function afterLoad()
  {
      var elements = YAHOO.util.Dom.getElementsByClassName('action-link');
      for ( var element in elements )
      {
      if(elements[element].id=="") elements[element].id = "el_" + element;
          YAHOO.util.Event.addListener(elements1[element].id, "click", fnCallback);
      }
  
  }
  YAHOO.util.Event.onContentReady( "Share", afterLoad, null, false ); 
  </code></pre>