[ Element1, Element2 ].forEach(function(element) { element.addEventListener("input", function() { this function does stuff }); });