Forked from VinnyFonseca/addeventlistener-multiple-events.js
Created
May 3, 2019 12:22
-
-
Save fedorenkodev/06d3ea8e68526d1072dccbbae4fd3d2c to your computer and use it in GitHub Desktop.
addEventListener multiple events
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
["change", "keyup", "paste", "input", "propertychange", "..."].forEach(function(event) { | |
document.querySelectorAll('.element').addEventListener(event, function() { | |
// Your callback here | |
}, false); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment