i done something similar but how you keep open just the one you clicked, and the other one(s) closed?
@gotreehouse2 жыл бұрын
There are many ways to do this! One way to only open one accordion at a time is that you'll want to grab a collection of accordion elements and remove the active class on all of them and then add the active class on the clicked accordion.
@iam-arshadB2 жыл бұрын
We can use the builtin summary & detail html tags to save our time and effort.
@Knards2 жыл бұрын
Thanks!
@ahmedadennoor49542 жыл бұрын
so helpfull bro keep going i alos want to be developer
@spiritualforce Жыл бұрын
Thank you
@TheBarceloner2 жыл бұрын
First 🎉
@jesusserna94152 жыл бұрын
Thanks!! I didnt know how to do this component, im still learning js => the only part that i modified was (if/else) with ternary operator : let btnsIcon = accordion.querySelector("button"); btnsIcon.textContent === "+" ? (btnsIcon.textContent = "-") : (btnsIcon.textContent = "+");
@gotreehouse2 жыл бұрын
Love your use of a ternary! Very nice alternative!