Get radio button value in JavaScript
Here's how to get the currently checked value of radio button section. The parameter elementName is the name attribute of the radio input.
JavaScript:
-
function getRadioValue(elementName)
-
{
-
var element = document.getElementsByName(elementName);
-
var bt_count = element.length; // can't use element.length in the loop, as it would decrement
-
-
for (var i = 0; i <bt_count; i++)
-
if (element[i].checked == true)
-
return element[i].value;
-
}

