Created
May 8, 2016 10:11
-
-
Save julesbou/82b0f7043f56c72f6a32d518ad88b354 to your computer and use it in GitHub Desktop.
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
Node.prototype.on = HTMLElement.prototype.addEventListener | |
NodeList.prototype.on = function(event, cb) { | |
Array.prototype.forEach.call(this, el => el.addEventListener(event, cb)) | |
} | |
// usage: $('.element').on('click', ...) | |
// usage: $('.list-of-elements').on('click', ...) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment