I’m stuck at this: I’ve created tabs and corresponding tabpanels. By default, I’ve hidden the tabs. To make a tab visible, I use this JavaScript line:
document.getElementById("tab-id").setAttribute("selected", true);
However, the content of the corresponding tabpanel does not update as I expected. I’ve tried using this:
document.getElementById("tabbox-id").selectedPanel = "tabpanel-id";
But nothing is happening; the content of the tabpanel is not updated.
Any assistance will be highly appreciated.
The
selectedattribute is set internally, it is merely an indicator that selection changed – changing it won’t actually change selection. What you most likely want to do is this:Note that
selectedPanelis the panel and not its ID. Alternatively you could also useselectedIndex:Documentation