From 285ff5ebf9eb564cdf59c745d1adf48aa761faa3 Mon Sep 17 00:00:00 2001 From: aphel Date: Thu, 22 Apr 2021 14:24:17 +0100 Subject: [PATCH] querySelector will only select the first element. Adjust to QuerySelectorAll --- site/content/docs/5.0/components/list-group.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/site/content/docs/5.0/components/list-group.md b/site/content/docs/5.0/components/list-group.md index 76d0013e21..c49541bdba 100644 --- a/site/content/docs/5.0/components/list-group.md +++ b/site/content/docs/5.0/components/list-group.md @@ -532,9 +532,11 @@ If no tab was already active, the `hide.bs.tab` and `hidden.bs.tab` events will ```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 + }) +} ```