<div class="tabs">
<ul id="tab" class="nav nav-tabs">
<li class="active">
<a href="#feed" data-toggle="tab">Feed</a>
</li>
<li>
<a href="#dashboard" data-toggle="tab">Dashboard</a>
</li>
</ul>
</div>
When a user clicks the link below. i want to change the #dashboard li to active, and remove active from the #feed li. how do i do this?
<a href=".showfollowers" onclick='load_followers();' data-toggle="tab">See All</a>
You better use unobtrusive javascript:
<a href=".showfollowers" id="foo" data-toggle="tab">See All</a>
Code:
$('#foo').click(function(){
$('#dashboard').addClass('active');
$('#feed').removeClass('active');
load_followers();
return false; // if needed.
});
Though it can be done with inline scripts, inline code is deprecated.
<div class="tabs">
<ul id="tab" class="nav nav-tabs">
<li class="active"><a href="#feed" data-toggle="tab">Feed</a></li>
<li><a href="dashboard" data-toggle="tab">Dashboard</a></li>
</ul>
</div>
<a href="showfollowers" onclick='load_followers();' data-toggle="tab">See All</a>
$('.showfollowers').click(function(){
$(#tab li).removeClass('active');
$('#dashboard').parent().addClass('active');
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With