add event handler for when tabs are clicked