Open different tab from a different link For Bootstrap v4.6

when we are using tabs in design. there’s only one active tab at a time. and we set this manually, right.

I’m linking the bootstrap v4.6 tabs link here.

https://getbootstrap.com/docs/4.6/components/navs/#tabs

but what if we want other tabs to be active/shown sometimes.

lets passed the id along with the link from other pages.

<a class=”nav-link “ href=”./navtabs.html#order-tab” >My Order</a>

and at the navtabs.html page put this jquery at the bottom

Open different tab from a different link For Bootstrap v4.6
Open different tab from a different link For Bootstrap v4.6

let hash = window.location.hash;
if (hash) {
// show the tab
$(‘.nav-tabs a[href=”’ + hash + ‘“]’).tab(‘show’);

//clear the hash
hash = null;
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store