Created
May 17, 2012 20:49
-
-
Save mhairston/2721511 to your computer and use it in GitHub Desktop.
Cross-browser Event Listening
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from http://www.marceloduende.com/blog/?p=25 | |
function addCrossBrowseEventListener(myElement, myEvent, myFunction) { | |
if(myElement.addEventListener){ | |
myElement.addEventListener(myEvent, myFunction, false); | |
return true; | |
} else { | |
myElement.attachEvent('on'+myEvent, myFunction); | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment