Solved

Adding a class to a tab panel when the tab is selected

Posted on 2014-10-22
3
115 Views
Last Modified: 2015-01-02
How would i add a script that would add .z-index to the tab-panel that is active?

This is what i have:

<ul class="nav nav-pills pills-round" role="tablist" id="myTab">
<li class="active col-sm-4">Amount<a href="#tab1" role="tab" data-toggle="pill"><span>1</span></a></li>
<li class="col-sm-4"><hr>Name<a href="#tab2" role="tab" data-toggle="pill"><span>2</span></a></li>
<li class="col-sm-4"><hr>Payment<a href="#tab3" role="tab" data-toggle="pill"><span>3</span></a></li>
</ul>

When you select a tab, it opens a panel:

<div class="tab-content" id="myTabContent">
   <div class="tab-pane" id="tab1"></div>
    <div class="tab-pane" id="tab2"></div>
    <div class="tab-pane" id="tab2"></div>
</div>

I tried this script but it doesn't work. Any ideas?

$('.pills-round>li>a').click(function(){
$('.z-index').removeclass('z-index');
$('.active').addclass('z-index');
});
0
Comment
Question by:Miriam Fisher
3 Comments
 
LVL 27

Accepted Solution

by:
Sammy earned 500 total points
ID: 40397387
z-index is a reserved word (it is a css property name) you should change that to something else.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
The viewer will learn how to dynamically set the form action using jQuery.
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)

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now