How to open specific tab of bootstrap nav tabs on click of a particuler link using jQuery?

前端 未结 8 2114
Happy的楠姐
Happy的楠姐 2020-11-29 01:32

I am new to jquery and bootstrap,so please consider my mistakes.I have created a bootstrap modal for login and registration. It contains two nav-tabs called as login and reg

8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-29 02:25

    Applying a selector from the .nav-tabs seems to be working

    HTML is

    
    
    ...Content...
    ...Content...
    ...Content...

    Script is

    $(document).ready(function(){
      activaTab('aaa');
    });
    
    function activaTab(tab){
      $('.nav-tabs a[href="#' + tab + '"]').tab('show');
    };
    

    http://jsfiddle.net/pThn6/80/

提交回复
热议问题