views:

35

answers:

1

I'm using a component writen in javascript. The component is exposing some events. The problem is I can't figure out who is the sender. They don't provide an instance of the sender as a parameter (like jQuery does).

My question is: Is there any way to hook up the event using javascipt/jquery or any other way to get the sender?

All I know is the event name.

+1  A: 

If I am correct in what you want: event.srcElement

http://msdn.microsoft.com/en-us/library/ms534638%28VS.85%29.aspx

Note: This does not work in Firefox.

For FF and most likely Webkit:

img.onclick = function (e) { 
 if (window.event) e = window.event; 
 var srcEl = e.srcElement? e.srcElement : e.target; 
 // srcEl now can be used x-browser.  
 // (rest of the script here) 
}
lighthazard