How can I activate / deactivate a certain tab

1 reply · opened Oct 7, 2024

NnojunkthanksOct 7, 2024

For example, on the Tabs demo page. Say for example on the bordered-style Right-aligned set of tabs.

There are 4 tabs: Home, Profile, Contact, About.

How can I programatically (say off a button click, page load, or some other event), activate the Contact tab?

SSemicolon WebSTAFFNov 7, 2024

Hello,

Simply add the data-active="2" Attribute to the .canvas-tabs Element based on the Index of the "Contact Tab". This will activate the Contact Tab on Page Load/Initialization. For more JS Methods to initialize the Tabs according to your needs, consider checking the Documentation: https://getbootstrap.com/docs/5.3/components/navs-tabs/#methods .

This will definitely work fine. Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard