views:

60

answers:

1

So I created some tab using XUL. How can I write javascript code so that if I click on a button in tab 1, tab 2 will be shown?

Thanks

A: 

Get the tabs element and set the selected Index property to the index of the tab you want. e.g. if the tabs element is 'mytabs' and you want to select the 2nd tab...

document.getElementById("mytabs").selectedIndex = 1;
pc1oad1etter
Beautiful! Thank you very much.
chepukha
BTW, can you show me how I can do so that when a button is clicked, a new tab is created? The idea is I have a list of items in 1 tab, when I click a button, say "Add item", a new tab will be opened so that I can I fill in info about the new item. Thanks in advance.
chepukha
You have not accepted any answers!
pc1oad1etter