"Select a tab below:" 0 A B /*1*/tabbox.getTabs().removeChild(tabB); /*2*/tabbox.getTabpanels().removeChild(panelB); C (click will remove B and open C) //same code as above only the following 2 lines are switched /*2*/tabbox.getTabpanels().removeChild(panelA); /*1*/tabbox.getTabs().removeChild(tabA); D (click will remove A and should open D) ERROR happens E gets opened E Content0 ContentA ContentB ContentC ContentD ContentE