I would like to toggle a checkbox on then off after a single click of an action button. Is this possible? I want to momentarily style an html element when an action button is pressed.
example html
<button type="action" name="act_dice_pool_clear" class="dice-footer-clear">Clear Pool</button> <input class="hidden roll-indicator" type="checkbox" name="attr_roll_the_dice_flag" value="1" readonly/> <button class="dice-pool" type="roll" name="roll_the_dice" value="1d20">Roll</button>
on("clicked:act_dice_pool_clear", function () {
console.log(">>>> Change Detected: Clear Dice Pool <<<<");
getAttrs(["roll_the_dice_flag"], function (values) {
const roll_the_dice_flag = parseInt(values.roll_the_dice_flag, 10) || 0;
var buttonState = roll_the_dice_flag
if (roll_the_dice_flag===0) {
buttonState=1
}
else {
buttonState=0
}
setAttrs({
roll_the_dice_flag: buttonState
});
});
});
TIA.