This was a tricky one. You had two problems, and it looks like one is a bug with roll20. If you have an underscore in the button name, it doesnt get triggered. I changed this act_spell_expand_toggle to act_spell-toggle to get it working. There's a similar problem with repeating section names, which cant have a second underscore either. The second problem is, action buttons dont get the row id automatically, so you need to supply it using the eventInfo object. Here's code that works, assuming you rename the button as above: on("clicked:repeating_spells:spell-toggle", function(eventInfo) { // Check the current value of the hidden attribute. const rowid = eventInfo.sourceAttribute.split('_')[2]; getAttrs([`repeating_spells_${rowid}_spell_expand`], function(v) { // Toggle the hidden attribute value between "down" and "right" setAttrs({ [`repeating_spells_${rowid}_spell_expand`]: v[`repeating_spells_${rowid}_spell_expand`] !== "down" ? "down" : "right" }); }); }); Note that if this looks unfamiliar: `repeating_spells_${rowid}_spell_expand` it's just the same as doing this: "repeating_spells_" + rowid + "spell_expand" eventInfo works like values in getAttrs, and gives you a bunch of properties you can access. One is eventInfo.sourceAttribute That gives you the full name of the button clicked, like so console.log(eventInfo.sourceAttribute);
// gives: "repeating_spells_-M8Ja-GEzzNL4B3taRYD_spell-toggle" We can use split("_") to turn that into an array, and split("_")[2] gives the row id. It's all a bit more complicated than it needs to be. It's a shame it doesnt work as smoothly as attributes.