1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-21 12:51:52 +02: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> </table>
```js ```js
var tabEl = document.querySelector('a[data-bs-toggle="list"]') var tabElms = document.querySelectorAll('a[data-bs-toggle="list"]')
tabEl.addEventListener('shown.bs.tab', function (event) { tabElms.forEach(function(tabElm) {
tabElm.addEventListener('shown.bs.tab', function (event) {
event.target // newly activated tab event.target // newly activated tab
event.relatedTarget // previous active tab event.relatedTarget // previous active tab
}) })
}
``` ```