adding event handlers for adding elements on tab clicks