?
Solved

jquery tab - get all tab IDs

Posted on 2012-09-13
4
Medium Priority
?
610 Views
Last Modified: 2012-09-14
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
0
Comment
Question by:bamapie
  • 2
  • 2
4 Comments
 
LVL 8

Expert Comment

by:soupBoy
ID: 38397031
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...
0
 

Author Comment

by:bamapie
ID: 38397073
>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.
0
 
LVL 8

Accepted Solution

by:
soupBoy earned 2000 total points
ID: 38397085
Right on.

So then try this:
$('.ui-tabs-nav li').each(function(index){
    alert('I am index: ' + index + ' and my id is: ' + $(this).attr('id'));
});

Open in new window

0
 

Author Closing Comment

by:bamapie
ID: 38399138
Fantastic.  Thanks.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question