javascript - Dynamically set active menu item using data-toggle -
i have menu included in file , b. don't want of tabs active @ first after clicking on them want set correct list item's class="active". thought code below it. need add or change?
<ul id="navbar_menu" class="nav nav-tabs"> <li><a data-toggle="tab" href="#">a</a></li> <li><a data-toggle="tab" href="#">b</a></li> </ul>
fyi: have included following html page (do need more this):
href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
http://getbootstrap.com/javascript/#tabs
according bootstrap's documentation (under title "markup"), still missing html.
so right, except need link's href
point id of actual tab, , not hash mark #
.
<ul id="navbar_menu" class="nav nav-tabs"> <li><a data-toggle="tab" href="#tab1">a</a></li> <li><a data-toggle="tab" href="#tab2">b</a></li> </ul>
and need actual tabs created.
<div class="tab-content"> <div role="tabpanel" class="tab-pane" id="tab1">...</div> <div role="tabpanel" class="tab-pane" id="tab2">...</div> </div>
hope helps!