Is it possible to use DOM Macros by pulling the ID or Class name from a Sugarcube Variable?[Twine 2.3.16] [Sugarcube 2]

Basically, I’m trying to create an accordion by toggling the class hidden which has the CSS for hiding the element. I can do this manually by writing out the ID myself, but trying to automate the ID by using for loops only allows me to set the ID by using the @id attribute, but trying to refer to it in the macro with the same variable fails, be the variable temporary or global. Is this even possible, or should I just do this manually?

<<toggleclass "_AccordionID" "hidden">>

Don’t quote the variable name. E.g.,

<<toggleclass _AccordionID "hidden">>

SEE: Macro Arguments.

1 Like

Thanks for that. Funnily enough, I just figured it out myself and was about to come here and say that. Regardless, thanks for the help.