Bootstrap tab activation with JQuery

后端 未结 7 1249
花落未央
花落未央 2020-12-13 03:15

I have the following code

  • AAA
  • &
7条回答
  •  清歌不尽
    2020-12-13 04:07

    Having just struggled with this - I'll explain my situation.

    I have my tabs within a bootstrap modal and set the following on load (pre the modal being triggered):

    $('#subMenu li:first-child a').tab('show');

    Whilst the tab was selected the actual pane wasn't visible. As such you need to add active class to the pane as well:

    $('#profile').addClass('active');

    In my case the pane had #profile (but this could have easily been .pane:first-child) which then displayed the correct pane.

提交回复
热议问题