Posts

Showing posts with the label getelementsbyclassname

Javascript: enable buttons on checkbox' check (both with ElementsByClass)

Javascript: enable buttons on checkbox' check (both with ElementsByClass) I am sorry I have to bother you guys with such a noob question, but I am trying and googeling since two days now and I just dont seem to find the point I need, or maybe I just don't understand it. The case is the following: I have two rows in a table: 1. row checkbox - 2. 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="isamed" name="attr_targeted_checkbox1"> <button type='roll' class="isroll" disabled="true"> I used 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 (...