views:

42

answers:

1

I'm trying to setup a simple tabview from existing markup, ala this example from the YUI developer network. Works like a charm. However, my question is, how do you designate which of the tabs should be initially selected? Can it be done via the existing markup, or is the only way via javascript? This isn't really addressed in the examples or documentation that I could see...

+2  A: 

You ca select child by calling selectChild(index)

var tabview = new Y.TabView({srcNode:'#demo'});
tabview.render();
tabview.selectChild(1);

Hope this helps. :)

Fopfong
Yes, I have worked around my problem by using inline javascript and global variables. My question, however, was whether it is possible to indicate *via the markup* (i.e. html tags/classes/etc) which tab should initially be selected... it would seem to me if that's not possible it's an unfortunate omission.
vicatcu
So, just add class="selected" to li should works.
Fopfong