0

Hi in my script there is a jquery tab. The script is working, tab-content is changing but when clicked a tab I want to change class property of the li of active tab as class="current"
How can I do it? thanks.

<ul class="nav-content">
<li class="current first-li"><a href="#tabs-1">tab 1</a></li>
<li><a href="#tabs-2">tab 2</a></li>
<li><a href="#tabs-3">tab 3</a></li>
</ul>


<script>
$(document).ready(function() {



$(".tab_content").hide();


$("ul.nav-content current:first").addClass("active").show();
$(".tab_content:first").show();



//On Click Event
$("ul.nav-content li").click(function() {


$("ul.nav-content current").removeClass("active");
$(this).addClass("active");
$(".tab_content").hide();


var activeTab = $(this).find("a").attr("href");
$(activeTab).show();
return false;
});


});
</script>

Edited by Nick Evan: Fixed formatting

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by stbuchok
0

Use the select event of the tab control. In that event you can set it's class by using addClass.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.