Add event handler for when tabs are clicked