diff options
Diffstat (limited to 'script.js')
-rw-r--r-- | script.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/script.js b/script.js new file mode 100644 index 0000000..01458c9 --- /dev/null +++ b/script.js | |||
@@ -0,0 +1,11 @@ | |||
1 | // Toggle all <details> on the page (thanks elioat!) | ||
2 | |||
3 | const toggleDetails = () => { | ||
4 | document.body.querySelectorAll("details").forEach((e) => { | ||
5 | if (!e.classList.contains("info")) { | ||
6 | e.hasAttribute("open") | ||
7 | ? e.removeAttribute("open") | ||
8 | : e.setAttribute("open", true); | ||
9 | } | ||
10 | }); | ||
11 | }; | ||