Link to home
Start Free TrialLog in
Avatar of headjava
headjava

asked on

Reseting a checkbox using a dynamic variable

I have a list of unrelated checkboxes (each has own name and id). When the user clicks any one the CB's I combine the value of a textarea and the value of the CB and replace the combine value back into the current textarea. Works fine. Now I want to clear the check from the CB. I'm sure there is something simple I've overlooked. Thanks for any suggestions.
checkbox.txt
ASKER CERTIFIED SOLUTION
Avatar of BenMorel
BenMorel

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ilaird
ilaird

the simplest way to reset all the checkboxes depends on your layout.

a few thoughts.
If you append all your check boxs with spacific prefix and increment a number you could do some thing like:
for(var i = 0; i < [how ever many CB's you have]; i++)
  document.getElementById('ckb' + i).checked = false;

another option would be to group all the CBs in a table or div. then you could loop through rows or childNode[x] to reset checked to false;
Avatar of headjava

ASKER

Thanks