on click a button triger a tab bootstrap 5
To trigger a tab in Bootstrap 5 when a button is clicked, you can use the data-bs-toggle
and data-bs-target
attributes. Here's an example:
<button type="button" class="btn btn-primary" data-bs-toggle="tab" data-bs-target="#myTab">Click me</button>
<div class="tab-content">
<div class="tab-pane fade" id="myTab">
<!-- Tab content goes here -->
</div>
</div>
In this example, the button has the data-bs-toggle="tab"
attribute, which indicates that it should trigger a tab. The data-bs-target="#myTab"
attribute specifies the ID of the tab that should be activated when the button is clicked. The tab content is placed inside a <div>
element with the tab-content
class, and each tab pane is defined using the <div>
element with the tab-pane
class and a unique ID.
Please note that this example assumes you have already included the necessary Bootstrap 5 CSS and JavaScript files in your HTML document.
I hope this helps! Let me know if you have any further questions.