
Hello, I wanted to do a checkbox for turn on/off Actions Tokens. What I want is relativly simple, I just don't know the way. When tickbox is 0, I want to change the name of "tokenaction" so it don't display on top left corner. When tickbox is 1, it display. There it is the html and my JS My JS is working good, but tokenaction seem to be work in a strange way, I don't understand well :/ < div class = "sheet-hidden" > < button id = "token1" type = "roll" class = 'tokenaction' name = 'attr_actiontoken_fortitude' value = "@{roll_fortitude}" ></ button > </ div > < select class = "sheet-checkbox" name = "attr_fortitude_tickbox" > < option class = "sheet-no" selected value = "0" >✗</ option > < option class = "sheet-yes" value = "1" >✓</ option > </ select >
< script type = "text/worker" > on('change:fortitude_tickbox', function() { console.log("ChangeFortitude"); getAttrs(["fortitude_tickbox"], function(values) { var fortitudeTickbox = parseInt(values["fortitude_tickbox"]) || 0; console.log(fortitudeTickbox); console.log(values); if (fortitudeTickbox == '1') { console.log("Tickbox = 1"); console.log($20(".token")); $20("#token1").addClass('tokenaction'); $20("#token1").removeClass('token'); } else { console.log("Tickbox = 0"); $20("#token1").removeClass('tokenaction'); $20("#token1").addClass('token'); } }); }); </ script >