views:

245

answers:

1

I know I can get the index of the currently selected tab but can I somehow get to the ID (the equivalent of the ui.panel.id if this were triggered by an tab event...but it's not) of the currently selected tab? I'd prefer not to use the index because ordering of the tabs might change. I prefer not to use the style markups as those may change in future releases. Is there a method for this? If not, can I somehow use the index to access this (maybe even by accessing the panel object first)? Any other ideas?

+7  A: 

You should be able to select whichever tab has the active class associated with it, and get the ID from there. If I'm not mistaken, that would be $(".ui-state-active").attr("id");

Jonathan Sampson
That's pretty goofy. What if you have multiple tab widgets on a page, for instance?
Ask Bjørn Hansen
Then you give a more specific selector. `$("#group1 .ui-state-active")`.
Jonathan Sampson