Reputation: 195
In bootstrap documentation they say You can activate a tab or pill navigation without writing any JavaScript. I try it like they said by simply specifying data-toggle="tab"
on an element and by the href
and the ID
. But it doesn't work.
Do i have to add something else ?
<ul class="nav nav-pills nav-stacked col-xs-3">
<li><a data-toggle="tab" href="one">one</a></li>
<li><a data-toggle="tab" href="two">two</a></li>
<li><a data-toggle="tab" href="three">three</a></li>
<li><a data-toggle="tab" href="four">four</a></li>
</ul>
<div class="tab-content col-xs-9">
<div id="one" class="tab-pane active">
Germany
</div>
<div id="two" class="tab-pane">
France
</div>
<div id="three" class="tab-pane">
Italy
</div>
<div id="four" class="tab-pane">
Spain
</div>
</div>
Upvotes: 0
Views: 1381
Reputation: 1771
Check Ismail Farooq answer first, if still not work then you need to check did you add both jQuery library and bootstrap.js yet. Add those two two your page, jQuery first then bootstrap one and you will be fine.
Upvotes: 0
Reputation: 6837
You missed #
in href
where you call ID for example href="#one"
<ul class="nav nav-pills nav-stacked col-xs-3">
<li><a data-toggle="tab" href="#one">one</a></li>
<li><a data-toggle="tab" href="#two">two</a></li>
<li><a data-toggle="tab" href="#three">three</a></li>
<li><a data-toggle="tab" href="#four">four</a></li>
</ul>
<div class="tab-content col-xs-9">
<div id="one" class="tab-pane active">
Germany
</div>
<div id="two" class="tab-pane">
France
</div>
<div id="three" class="tab-pane">
Italy
</div>
<div id="four" class="tab-pane">
Spain
</div>
</div>
live example
Upvotes: 1