Javascript function not working for radiobutton list
<p>I have a javascript function wherein based on selection I have to enable a row and disable a button on the same page. Earlier it was handled via code behind and was working fine with the same logic. Now it does not work. </p>

<p><strong>JS function:</strong></p>

<pre><code>function ValidateRadioButtonList()
{         
   var RBL = document.getElementById('&lt;%=rbListExamShot.ClientID%&gt;');
   var radiobuttonlist = RBL.getElementsByTagName("input");
   var counter = 0;
   var atLeast = 1
   for (var i = 0; i &lt; radiobuttonlist.length; i++) {
   if (radiobuttonlist[i].checked) {

   counter++;
   var selected = i;
   }
   }
   if (atLeast = counter) {
   // return arguments.IsValid;
   var RowMessage = document.getElementById  ('&lt;%                               =RowCliamMessage.ClientID%&gt;');
   RowMessage.style.display = "block";
   }
   else {

   RowMessage.style.display = "none";
   }
   if (selected == 1) {

   var Submit = document.getElementById('&lt;%=Save.ClientID%&gt;');
   Submit.disabled = true;
   return false;
   }
   else {
   return true;
   }
 } 
</code></pre>

<p>asp.net control and validator:</p>

<pre><code>   &lt;td  align="left"&gt;
            &lt;asp:RadioButtonList CssClass="label" ID="rbListExamShot" runat="server" AutoPostBack="true"
                RepeatDirection="Horizontal" ValidationGroup="Save"  
                onselectedindexchanged="rbListExamShot_SelectedIndexChanged"&gt;
                &lt;asp:ListItem Text="Single Shot" Value="1"&gt;&lt;/asp:ListItem&gt;
                &lt;asp:ListItem Text="Double Shot" Value="2"&gt;&lt;/asp:ListItem&gt;
            &lt;/asp:RadioButtonList&gt;
            &lt;/td&gt;
            &lt;td&gt;
              &lt;asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" Text="Please select voucher type"
                Display="Dynamic" ControlToValidate="rbListExamShot" ValidationGroup="Save"
                ForeColor="Red" Font-Bold="False"&gt;&lt;/asp:RequiredFieldValidator&gt;
                 &lt;asp:CustomValidator ID="CustomValidator1" runat="server" ValidationGroup="Save"
                Display="Dynamic" ErrorMessage=".Double Shot Vouchers cannot be reimbursed."
                ControlToValidate="rbListExamShot" ClientValidationFunction="ValidateRadioButtonList"
                ForeColor="Red" Font-Bold="False"&gt;&lt;/asp:CustomValidator&gt;
        &lt;/td&gt;
</code></pre>
