I am trying to get the selected value from the radio button this is the jsfiddle.
HTML :
<table>
    <tr>
        <td> Is Reference Number Available</td>
         <td> <input type="radio" name="group1" value="yes" onchange="isReferenceNumberAvailable()"> Yes</input> 
              <input type="radio" name="group1" value="no" onchange="isReferenceNumberAvailable()"> No </input>
        </td>
    </tr>
</table>
javascript :
function isReferenceNumberAvailable()
{    
        var test = document.getElementsByName("group1");
        for(var elem in test)
        {
            if(test[elem].checked)
            {
                alert(test[elem].value);  // got the element which is checked      
                if(test[elem].value=="yes")
                    alert("Need to create Reference select box");
                else if(test[elem].value=="no")
                    alert("don't create ");      
            }
        }
} 
But when I select the radio button i get the following :
Uncaught ReferenceError: isReferenceNumberAvailable is not defined 
 
     
    
 
     
     
    