0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-18 10:52:19 +01:00

querySelector will only select the first element. Adjust to QuerySelectorAll

This commit is contained in:
aphel 2021-04-22 14:24:17 +01:00 committed by Mark Otto
parent 2f734af472
commit 285ff5ebf9

View File

@ -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) {
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
})
})
}
```