Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fedorenkodev/06d3ea8e68526d1072dccbbae4fd3d2c to your computer and use it in GitHub Desktop.
Save fedorenkodev/06d3ea8e68526d1072dccbbae4fd3d2c to your computer and use it in GitHub Desktop.
addEventListener multiple events
["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