
Hey guys!
I am new here and I am currently editing a existing character sheet. I added a dice button in the repeating_spells list, for "targeted" spells.
Since not all spells have to be targeted, I wrote a javascript. Everytime the checkbox in a row is checked, the button should be enabled.
I tested the script in fiddle and it worked. So far so good, but it doesn't work in the sheet. As far as I read, I need a on(change) function, but I am not sure, which one.
The javascript is the following:
var inputs = document.getElementsByClassName('isaimed');
for (var i = 0; i < inputs.length; i++) {
inputs[i].addEventListener('click', function() {
if (this.checked) {
this.parentElement.nextElementSibling.children[0].disabled = false;
return;
}
this.parentElement.nextElementSibling.children[0].disabled = true;
})
}
I hope you guys can help me with this, I am working on it since two days and I start to feel stupid.
Thank you very much for your help!