Loading...
panels.forEach((p) => p.addEventListener('toggle', () => {
if (p.open) panels.forEach((o) => {
if (o !== p) o.open = false;
});
}));<details name="faq"><summary>Shipping</summary>...</details>
<details name="faq"><summary>Returns</summary>...</details>Sharing a name makes the browser close the other panels, so no script is needed.
<details> in the group has the same name value.<details> starts with a <summary> that describes its content.Yes. Add open to one <details> in the group. If several have it, only the first stays open.
No. On <details> it only groups panels into an accordion.