Modified event listener for outputtag