Updated JavaScript to prevent link event for tab navigation.