Loading ...
Sorry, an error occurred while loading the content.

Re: how to pass argument in addlistener?

Expand Messages
  • y_lsmith
    Elankeeran, You can provide an arbitrary object/value as the forth parameter to addListener. This obj/val will be passed to the callback.
    Message 1 of 5 , Oct 9, 2007
    • 0 Attachment
      Elankeeran,

      You can provide an arbitrary object/value as the forth parameter to
      addListener. This obj/val will be passed to the callback.

      YAHOO.util.Event.addListener("myelementid", "click", fnCallback2, {
      foo : 'bar' });

      function fnCallback(evt, stuff) {
      ...stuff contains { foo : 'bar' }...
      }

      Take a look at the API docs for further info
      http://developer.yahoo.com/yui/docs/YAHOO.util.Event.html#addListener

      Regards,
      Luke

      --- In ydn-javascript@yahoogroups.com, Elankeeran <ekeeran@...> wrote:
      > YAHOO.util.Event.addListener("myelementid", "click", fnCallback2);
      > Elankeeran V
    Your message has been successfully submitted and would be delivered to recipients shortly.