Solved

How to get the selected spry tab with Jquery?

Posted on 2013-01-15
4
477 Views
Last Modified: 2013-01-15
Hello guys

When I click on the tab I need to get the selected spry tab with jquery, so that I can go on with my code. I can't figure out how to get the selected tab index.

<div id="TabbedPanels1" class="TabbedPanels">
  <ul class="TabbedPanelsTabGroup">
    <li class="TabbedPanelsTab" id="tab1">Tab 1</li>
    <li class="TabbedPanelsTab" id="tab2">Tab 2</li>
    <li class="TabbedPanelsTab" id="tab3">Tab 3</li>
  </ul>
  <div class="TabbedPanelsContentGroup">
    <div class="TabbedPanelsContent">Content 1</div>
    <div class="TabbedPanelsContent">Content 2</div>
    <div class="TabbedPanelsContent">Content 2</div>
  </div>
  <input type="submit" value="complete" class="complete">  
</div>

Open in new window


thanks
0
Comment
Question by:hidrau
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
soupBoy earned 500 total points
ID: 38778132
$('.TabbedPanelsTab').on('click', function(){
  alert($(this).attr('id'));
});

Take a look at this fiddle I created: http://jsfiddle.net/slim81/6ZTJK/
0
 
LVL 1

Author Comment

by:hidrau
ID: 38778168
yeah, it was what I really wanted.

thanks very much
0
 
LVL 1

Author Closing Comment

by:hidrau
ID: 38778171
thanks
0
 
LVL 82

Expert Comment

by:leakim971
ID: 38778202
do have jQuery running perfectly? no plugin conflict?

EDIT : ok, ok I'm late lol
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

828 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