Button to Trigger Nav-Tab with Twitter Bootstrap

后端 未结 4 2075
遇见更好的自我
遇见更好的自我 2021-02-04 13:07

This button triggers the next tab to load content, but the tab itself does not switch, it remains on the first tab..


4条回答
  •  时光说笑
    2021-02-04 13:41

    Using Bootstrap 4

    var nextTab;    
        $('.nav-link').map(function(element) {
                        if($(this).hasClass("active")) {
                            nextTab = $(this).parent().next('li');
                        }
                    })
    
        nextTab.find('a').trigger('click');
    

提交回复
热议问题