Created
November 18, 2016 15:51
-
-
Save liximomo/0b603992ac0932109e08609b0c06b992 to your computer and use it in GitHub Desktop.
dom utils
This file contains hidden or 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 addDOMEvent(html_element, event_name, event_function, useCapture) | |
{ | |
if(html_element.addEventListener) { | |
html_element.addEventListener(event_name, event_function, useCapture); //don't need the 'call' trick because in FF everything already works in the right way | |
return; | |
} | |
//Internet Explorer | |
html_element.attachEvent("on" + event_name, function() { event_function.call(html_element); }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment