How to check if radio button in radio button list was selected
<p>Good morning</p>

<p>I am having some difficuly in looping through a radiobutton list in order to check if it was selected or not using Javascript.
With C# Asp.net the procedure is relatively easy but with the Javascript I am struggling a little.</p>

<p>This is the code I use with C# to check if the radion button was selected.</p>

<pre><code>protected void Button1_Click(object sender, EventArgs e)
{
    string radValue = RadioButtonList1.SelectedValue.ToString();

    if (radValue == "")
    {
        lblError.Text = "Please select neigbourhood";
    }
    else
    {
        lblError.Text = "You come from " + radValue;
    }

}
</code></pre>

<p>The code I use with javascript is a little faulty and I was hoping it could be corrected.</p>

<pre><code>var radNeighbourhood;

for(var loop=0; loop &lt; document.subscribeForm.myRadio.length; loop++)
{
    if(document.subscribeForm.myRadio[loop].checked == true)
    {
        radNeighbourhood = document.subscribeForm.myRadio[loop].value;
        break;

    }
    else
    {
        alert("Please select a neigbourhood");
        return false;
    }
}
return true;    
</code></pre>

<p>Kind regards
Arian</p>
