Is there a way to take the current target of an event with IE 7 or 8?
With other browser (firefox, opera, chrome etc.) we can use
event.currentTarget or
Additional note: Sometimes IE (like ie 7) will return undefined for event.target, so it won't even evaluate it as true or false (whether in an if or in a ternary operator). Furthermore, even if you try typeof event.target == 'undefined' it will still error saying "event.target is undefined." Which of course is stupid because that's what you're testing.
Apparently it is a problem with passing events into functions in older IE. What you do to fix it is:
event = event ? event : window.event;
if (typeof event.target == 'undefined') {
var target = event.srcElement;
} else {
var target = event.target;
}
Make note that you re-write the event in standards compliant browsers and grab the global event for IE.