I am a beginner with jQuery and I am trying to modify a script. The script demo is here. Right now, they add a line above the selected tab, which I don’t want. What I want to do is just add a class to the anchor like a
<a class="tab active" href="#">Tab Name</a>
that way I can just use CSS to change the background color or something for the active buttons.
The code below is what they currently have for when you click on a tab.
the_tabs.click(function(e){
/* "this" points to the clicked tab hyperlink: */
var element = $(this);
/* If it is currently active, return false and exit: */
if(element.hasClass('.active')) return false;
$(this).addClass('active')
1 Answer