Say I have a function similar to this:
function getGroupValue(group) { for (var i=0; i < group.length; i++) { if (group[i].checked) { return group[i].value; } } }
that i can call with something like getGroupValue(document.forms[0].myGroup)
How do I convert this to just passing in the name of a html radio button group like getGroupValue('myGroupName') ?
This should work: