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
I'd like to give a more simple answer, the meat of this is the same as the meat in anas' and user1515360's answers:
if (browserDoesNotUnderstandCurrentTarget) {
someElement.onclick = function (e) {
if (!e) { var e = window.event; }
e.currentTarget = someElement;
yourCallback(e);
}
}
else {
someElement.onclick = yourCallback;
}
Substitute onclick for whatever event you wish of course.
This makes e.currentTarget available on browsers that do not support currentTarget.