Bootstrap Tabs: Next & Previous Buttons for Forms

后端 未结 3 1101
半阙折子戏
半阙折子戏 2020-12-08 02:10

I am trying to (eventually) split a form over several Bootstrap 3.x tabs, but I am having trouble with the previous and next buttons. Only the first next button functions an

3条回答
  •  没有蜡笔的小新
    2020-12-08 03:02

    First at All : ID MUST BE UNIQUE

    Here is your working code : http://www.bootply.com/120472

    HTML :

    
    
    

    JS :

     $('.btnNext').click(function(){
      $('.nav-tabs > .active').next('li').find('a').trigger('click');
    });
    
      $('.btnPrevious').click(function(){
      $('.nav-tabs > .active').prev('li').find('a').trigger('click');
    });
    

    Snippet:

     $('.btnNext').click(function(){
      $('.nav-tabs > .active').next('li').find('a').trigger('click');
    });
    
      $('.btnPrevious').click(function(){
      $('.nav-tabs > .active').prev('li').find('a').trigger('click');
    });
    
    
    
    
    

提交回复
热议问题