corred js to switch tab