Created
July 16, 2017 13:42
-
-
Save vanaf1979/8fc51bc782b3c65696d43a59aa20c98d to your computer and use it in GitHub Desktop.
Add an event listner
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
function addEvent( ellement , type , callback ) | |
{ | |
if ( ellement.attachEvent ) | |
{ | |
ellement.attachEvent( 'on' + type , callback ); | |
} | |
else | |
{ | |
ellement.addEventListener( type , callback ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment