I actually have a pretty simple question, but I've been trying for two days now and I just don't find an answer I need, or maybe I just don't understand it.
That is my problem: I have two rows in a table:
row checkbox
row button
I want the button only be enabled, if the checkbox in the same row is enabled. Picture for better understanding
<input type="checkbox" class="isaimed" name="attr_targeted_checkbox1">
<button type='roll' class="isroll" disabled="true">
I use classes and stumbled across getElementsByClassName
and the fact, that you get an array/node of objects.
I tried something like this:
var buttons = document.getElementsByClassName('isroll')
var keyselects = document.getElementsByClassName('isaimed');
for (var i = 0; i < keyselects.length; i++) {
if (keyselects[i].checked == true) {
buttons[i].disabled = false;
break;
}
}
and like 20 other codeparts and functions I found on the web, but it's not working. Maybe I have to assign the rows or something like that? Really, I am just utterly desperate and my mind is full of chunk right now.
Thank you very much for your help!