How to open a tab from external link?

后端 未结 2 995
醉酒成梦
醉酒成梦 2020-12-09 20:38

I am using Bootstrap 4 for my web page, I am facing problem with the nav-tabs.

I need to open a Forget Password Tab from the Login Tab Content page

2条回答
  •  悲&欢浪女
    2020-12-09 21:22

    This can be achieved with jQuery by triggering a function that changes the tab when the link is clicked.

    HTML

    
    
    Forgt password tab
    sign-up tab

    Javascript

    $( ".forgot-password-link" ).click(function() {
        $('#myTabs li:nth-child(2) a').tab('show')
    });
    

    Codepen example: https://codepen.io/Washable/pen/VQYewy

提交回复
热议问题