Skip to content

Instantly share code, notes, and snippets.

@Cycymomo
Last active December 20, 2015 12:19
Show Gist options
  • Save Cycymomo/6130619 to your computer and use it in GitHub Desktop.
Save Cycymomo/6130619 to your computer and use it in GitHub Desktop.
bindEvent.js
var bindEvent = function( element, type, eventHandler ) {
if ( element.addEventListener ) {
element.addEventListener( type, eventHandler, false );
} else if ( element.attachEvent ) {
element.attachEvent( "on" + type, eventHandler );
}
};
bindEvent(document.getElementById('mon_element'), 'change', function () {
alert('je change !');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment