mirror of
https://github.com/Hopiu/bootstrap.git
synced 2026-03-19 22:10:24 +00:00
querySelector will only select the first element. Adjust to QuerySelectorAll
This commit is contained in:
parent
2f734af472
commit
285ff5ebf9
1 changed files with 7 additions and 5 deletions
|
|
@ -532,9 +532,11 @@ If no tab was already active, the `hide.bs.tab` and `hidden.bs.tab` events will
|
|||
</table>
|
||||
|
||||
```js
|
||||
var tabEl = document.querySelector('a[data-bs-toggle="list"]')
|
||||
tabEl.addEventListener('shown.bs.tab', function (event) {
|
||||
event.target // newly activated tab
|
||||
event.relatedTarget // previous active tab
|
||||
})
|
||||
var tabElms = document.querySelectorAll('a[data-bs-toggle="list"]')
|
||||
tabElms.forEach(function(tabElm) {
|
||||
tabElm.addEventListener('shown.bs.tab', function (event) {
|
||||
event.target // newly activated tab
|
||||
event.relatedTarget // previous active tab
|
||||
})
|
||||
}
|
||||
```
|
||||
|
|
|
|||
Loading…
Reference in a new issue