From: Marcus Bointon Enable tabbable tabs via javascript: You can also activate a specific tab (or a pseudo-selected one) on init: You can activate a tab or pill navigation without writing any javascript by simply specifying Using bootstrap-tab.js
$('#myTab').tab('show')
+
+$('#myTab a[href="#profile"]').tab('show');
+$('#myTab a:last').tab('show');
+
Markup
data-toggle="tab" or data-toggle="pill" on an element.
@@ -653,7 +658,7 @@ $('#myModal').on('hidden', function () {
Activates a tab element and content container. Tab should have either a `data-target` or an `href` targeting a container node in the dom.
-<ul class="nav nav-tabs">
+<ul class="nav nav-tabs" id="myTab">
<li class="active"><a href="#home">Home</a></li>
<li><a href="#profile">Profile</a></li>
<li><a href="#messages">Messages</a></li>
@@ -669,7 +674,7 @@ $('#myModal').on('hidden', function () {
<script>
$(function () {
- $('.tabs a:last').tab('show')
+ $('#myTab a:last').tab('show')
})
</script>