refactored code to allow user to hide list text using a click event