Skip to content Skip to sidebar Skip to footer

How To Activate Not Default Bootstrap Tab From Outer Page?

I have which have two links. First goes to page with default activated tab, and second link - to second tab. I alway get default tab activated. Here is my js code(opens tab #home

Solution 1:

I changed my link:

<ahref="/websites/4#profile"class="activate_tab">aaa</a>

and my JavaScript:

var activeTab = $('[href=' + location.hash + ']');
activeTab && activeTab.tab('show');

$('.activate_tab').click(function(e){
$('#myTab a[href="#profile"]').tab('show');
});

Solution 2:

try this

   <div class="tab-pane fade"id="home">//default
 ...
 <div class="tab-pane fade in active"id="profile">//not default

or you can try on your second link page

$('#myTab a:last').tab('show'); // Select last tab
$('#myTab li:eq(1) a').tab('show'); 

Post a Comment for "How To Activate Not Default Bootstrap Tab From Outer Page?"