Skip to content

Instantly share code, notes, and snippets.

@mhairston
Created May 17, 2012 20:49
Show Gist options
  • Save mhairston/2721511 to your computer and use it in GitHub Desktop.
Save mhairston/2721511 to your computer and use it in GitHub Desktop.
Cross-browser Event Listening
// 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