无法激活选项卡

时间:2015-06-24 12:28:19

标签: jquery twitter-bootstrap

以下是我遇到的问题的快照:

enter image description here

当我按下它时,它会重定向到下一个标签,但不会更改活动标签 enter image description here

但我希望这个enter image description here

我的代码

compound

<ul class="nav nav-tabs"> <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li> <li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab"><icon class="fa fa-home"></icon> Profile</a></li> </ul> <div class="tab-content"> <div role="tabpanel" class="tab-pane fade in active" id="home"> <!---adding form --> <div class="container"> <div class="row"> <form role="form"> .......... <div class="row"> <div class="col-xs-3 col-sm-3 col-md-3"> <span class="button-checkbox"> ***<button type="button" class="btn" data-color="info" data-toggle="tab" data-target="#profile" tabindex="9">NEXT</button>*** </span> </div> </div> </form> </div> </div> </div> <div role="tabpanel" class="tab-pane fade" id="profile">.safsdgd.. </div> </div> </div>

1 个答案:

答案 0 :(得分:0)

这应该从所有菜单项中删除活动类,然后将其添加到单击的

(function($){
    $('ul.nav.nav-tabs li').click(function(){
        $('ul.nav li').each(function(){
            $(this).removeClass('active');
        });
        $(this).addClass('active');
    });
})(jQuery);