Monthly Archives: April 2015

Javascript get sending element in all browsers

   function mySweetClickEvent(event) {

        event = window.event || event; //NOTE: another lovely hack to make Firefox work…

        var target = event.target ? event.target : event.srcElement; //NOTE: another lovely hack to make IE work

        var senderToUse;

        if (target) {

            senderToUse = target; //this works for ie and chrome

        } else {

            senderToUse = event; //this works for firefox

        }

…do stuff with the sender here…

}