I almost copied the code from their website. The tab is initiated perfectly, and when I click on tabs, new panels are activated. However, the \"active\" class is not applied
My problem was that I sillily concluded bootstrap documentation is the latest one.
If you are using Bootstrap 4, the necessary working tab markub is: http://v4-alpha.getbootstrap.com/components/navs/#javascript-behavior
<ul>
<li class="nav-item"><a class="active" href="#a" data-toggle="tab">a</a></li>
<li class="nav-item"><a href="#b" data-toggle="tab">b</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="a">a</div>
<div class="tab-pane" id="b">b</div>
</div>
In my case (dynamically generating the sections): the issue was a missing "#" in href="#...".
My problem was with extra </div>
tag inside the first tab.
When I moved the following lines from the head section to the end of the body section it worked.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
Use this for your code
<ul class="nav nav-tabs" style="margin-top:10em;">
<li class="active" data-toggle="tab"><a href="#">Assign</a></li>
<li data-toggle="tab"><a href="#">Two</a></li>
<li data-toggle="tab"><a href="#">Three</a></li>
In my case, I have two elements with the same id
. I could not notice the cause of problem for a long time, because the first such element was hidden.