adding event listener for input