Hello everyone I am trying to implement a select all check box. So when it is checked all other checkboxes will be checked. I have used this url for help How to implement "select all" check box in HTML?
I have a java class that will build a datagrid based on some factors when the jsp is called.
I have written this code so far
javascript code
function toggle(source) {
checkboxes = document.getElementsByName('chk');
for(var i=0, n=checkboxes.length;i<n;i++) {
checkboxes[i].checked = source.checked;
}
}
my check box for select all
<th><b><dmf:checkbox name="ABoxes" onclick = 'toggle(this)' id="allABoxes" runatclient="true"/></b></th>
the checkbox that will be created when the data grid is created.
<td><dmf:checkbox name='chk' datafield='parent_id'/>
Currently when I select the check all check box nothing happens. I have gotten the java script to work if I change the dmf:button to input type="checkbox" but then it crashes some of my other code so I must leave them at dmf:button.
Thank you everyone for any help it is greatly appreciated. If some of what I have written doesn't make sense just let me know and I will try to clearify any questions.