show dynamically added navlinks when added in bootstrap navbar

后端 未结 1 1586
走了就别回头了
走了就别回头了 2020-12-06 23:13

I am new to Bootstrap, and can\'t seem to figure this out, i have navbar being used as javascript tab functionality of Bootstrap, which can have dynamically added and remove

1条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-06 23:53

    It doesn't look like you're using the standard Bootstrap nav/nav-tabs markup. If I were you I would simplify adding new tabs and tab content like this...

    Have a single function that creates the new tab, tab content and then makes it active. You can use the tab('show') method to activate the newly created tab:

    $('#btnAdd').click(function (e) {
        var nextTab = $('#tabs li').size()+1;
    
        // create the tab
        $('
  • Tab '+nextTab+'
  • ').appendTo('#tabs'); // create the tab content $('
    tab' +nextTab+' content
    ').appendTo('.tab-content'); // make the new tab active $('#tabs a:last').tab('show'); });

    Dynamic Bootstrap Tabs Demo

    Then you just need to customize it a little for your images.

    0 讨论(0)
提交回复
热议问题