Link to home
Start Free TrialLog in
Avatar of bamapie
bamapie

asked on

jquery tab - get all tab IDs

I'm using the jQuery tab widget found here:

http://jqueryui.com/demos/tabs/

All I'm looking to do is to iterate through all tabs, and retrieve the ID of each tab.  

This "id" value is the same id property that you'd get if you were inside the SELECT event handler and asked for ui.panel.id on the ui parameter.

o  I am NOT trying to retrieve this value inside an event.
o  I am NOT trying to retrieve this value for only the currently-selected tab.

I want to loop through all tabs and get this value for each tab, by index.  So, get the tab id for sub 0, sub 1, sub 2...

Thanks
Avatar of soupBoy
soupBoy
Flag of United States of America image

Can you post a bit of your code?  The JQuery UI example doesn't use ID's.  But you also say you want the index...but then the ID...so I am confused by what you need.  Explaining code issues in forums is always tough :)

I would think something similar to this is what you are looking for:
$('.ui-tabs-nav li').each(function(index){
    alert('I am index: ' + index + ' and my html value is: ' + $(this).html());
});

Open in new window


But the above code is based on the JQuery UI example...
Avatar of bamapie
bamapie

ASKER

>But you also say you want the index...but then the ID...
>so I am confused by what you need

I think the only time I use the term "index" is when I say that I want to get the id "by index".  Meaning, by tab offset.  By zero-based index into the set of tabs.
ASKER CERTIFIED SOLUTION
Avatar of soupBoy
soupBoy
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bamapie

ASKER

Fantastic.  Thanks.