Adding event listener to next button