Skip to content

Instantly share code, notes, and snippets.

@co1e
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save co1e/9836194 to your computer and use it in GitHub Desktop.

Select an option

Save co1e/9836194 to your computer and use it in GitHub Desktop.
Check radio/checkbox group for checked elements with group name
function checkGroupForCheckedElementsWithGroupName(name) {
var elements;
var flagged;
elements = document.getElementsByName(name);
flagged = true;
for (i = 0; i < elements.length; i++) {
if (elements[i].checked == true) {
flagged = false;
}
}
return flagged;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment