Maybe this is fine the way it is, but it seems messy. Basically I have dynamically generated HTML that will display a list of songs in a given folder. Each song has an ID, and I want to add a button that allows you to add every song in the folder.
Right now it's creating the add all button with the array of song IDs as an argument. It just feels messy since the list can be incredibly long and is now exposed to the HTML, but maybe it's fine?
It's currently working like this:
I could make the
songidarray a global variable and make the button static. But that seems like a cop out for some reason, maybe I'm just asking a stupid question and that's the answer right there. Wondering if there is a way to do it without using a global variable, or if there's nothing wrong with using one.