mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-19 11:51:23 +02:00
Update nav-tab.md
Updated the from anchor tag to button in sample examples
This commit is contained in:
@@ -525,7 +525,7 @@ You can activate a tab or pill navigation without writing any JavaScript by simp
|
|||||||
Enable tabbable tabs via JavaScript (each tab needs to be activated individually):
|
Enable tabbable tabs via JavaScript (each tab needs to be activated individually):
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var triggerTabList = [].slice.call(document.querySelectorAll('#myTab a'))
|
var triggerTabList = [].slice.call(document.querySelectorAll('#myTab button'))
|
||||||
triggerTabList.forEach(function (triggerEl) {
|
triggerTabList.forEach(function (triggerEl) {
|
||||||
var tabTrigger = new bootstrap.Tab(triggerEl)
|
var tabTrigger = new bootstrap.Tab(triggerEl)
|
||||||
|
|
||||||
@@ -539,10 +539,10 @@ triggerTabList.forEach(function (triggerEl) {
|
|||||||
You can activate individual tabs in several ways:
|
You can activate individual tabs in several ways:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var triggerEl = document.querySelector('#myTab a[href="#profile"]')
|
var triggerEl = document.querySelector('#myTab button[data-bs-target="#profile"]')
|
||||||
bootstrap.Tab.getInstance(triggerEl).show() // Select tab by name
|
bootstrap.Tab.getInstance(triggerEl).show() // Select tab by name
|
||||||
|
|
||||||
var triggerFirstTabEl = document.querySelector('#myTab li:first-child a')
|
var triggerFirstTabEl = document.querySelector('#myTab li:first-child button')
|
||||||
bootstrap.Tab.getInstance(triggerFirstTabEl).show() // Select first tab
|
bootstrap.Tab.getInstance(triggerFirstTabEl).show() // Select first tab
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -593,7 +593,7 @@ Activates a tab element and content container. Tab should have either a `data-bs
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var firstTabEl = document.querySelector('#myTab li:last-child a')
|
var firstTabEl = document.querySelector('#myTab li:last-child button')
|
||||||
var firstTab = new bootstrap.Tab(firstTabEl)
|
var firstTab = new bootstrap.Tab(firstTabEl)
|
||||||
|
|
||||||
firstTab.show()
|
firstTab.show()
|
||||||
|
Reference in New Issue
Block a user