travisbrown
Technical User
- Dec 31, 2001
- 1,016
Once more with feeling.
I'm trying to get all ckeckboxes within a div (regardless of child nodes) to check/uncheck based on the state of a master checkbox. Dan's post at is where I'm heading, but haveing a few implementation problems. I'm not sure how to get them unchecked. Can anyone help?
I'm trying to get all ckeckboxes within a div (regardless of child nodes) to check/uncheck based on the state of a master checkbox. Dan's post at is where I'm heading, but haveing a few implementation problems. I'm not sure how to get them unchecked. Can anyone help?
Code:
function CheckAll(theElement)
{
var cbs = document.getElementById(theElement).getElementsByTagName('input');
for (var loop=0; loop<cbs.length; loop++)
if (cbs[loop].type == 'checkbox') cbs[loop].checked = true;
}
Code:
<input name="checkall" id="checkall" type="checkbox" value="" onclick="CheckAll('recipientsList');" />