Skip to content

Instantly share code, notes, and snippets.

@gabrielstuff
Created October 11, 2012 10:46
Show Gist options
  • Select an option

  • Save gabrielstuff/3871583 to your computer and use it in GitHub Desktop.

Select an option

Save gabrielstuff/3871583 to your computer and use it in GitHub Desktop.
Invite all friends
function SetAllCheckBoxes(FormName, FieldName, CheckValue)
{
if(!document.forms[FormName])
return;
var objCheckBoxes = document.forms[FormName].elements[FieldName];
if(!objCheckBoxes)
return;
var countCheckBoxes = objCheckBoxes.length;
if(!countCheckBoxes)
objCheckBoxes.checked = CheckValue;
else
// set the check value for all check boxes
for(var i = 0; i < countCheckBoxes; i++)
objCheckBoxes[i].checked = CheckValue;
}
//To use
SetAllCheckBoxes('uq9y9m223', 'checkableitems[]', true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment