Monday, August 31, 2009

Get radio button value in js

Suppose your radio button grop is "radiogroup".
function getradioSelection() {
var group=document.getElementsByName("radiogroup");
var grp='';
for(var k=0;k<group.length;k++){
if(group[k].checked){
grp=group[k].value;
}
return grp;
}

This method will return the selected radio button value.

No comments:

Post a Comment