title: How can I count the number of radio boxes selected and validate?
body: <p>So here's what my code does: </p>
  
  <p>it displays 10 sets of radio buttons, each with 2 options. (so 20 radio buttons total). The 10 sets all have different names, but are within the same form. A person can only choose 5 buttons out of the 10. I have a piece of code that disables the radio buttons once 5 are selected. Now I want to prevent people from submitting the form if 4 or less buttons are selected. </p>
  
  <p>Here is an example of the code:</p>
  
  <p>HTML:</p>
  
  <pre><code> &lt;form method="post" action="index.php" name="buttons" onsubmit="return Validation()"&gt;
   &lt;input type="radio" id="button" value="first_button" name="1" /&gt;
   &lt;input type="radio" id="button" value="second_button" name="1" /&gt;
   &lt;input type="radio" id="button" value="first_button" name="2" /&gt;
   &lt;input type="radio" id="button" value="second_button" name="2" /&gt;
   &lt;input type="radio" id="button" value="first_button" name="3" /&gt;
   &lt;input type="radio" id="button" value="second_button" name="3" /&gt;
   &lt;input type="radio" id="button" value="first_button" name="4" /&gt;
   &lt;input type="radio" id="button" value="second_button" name="4" /&gt;
   &lt;input type="radio" id="button" value="first_button" name="5" /&gt;
   &lt;input type="radio" id="button" value="second_button" name="5" /&gt;
   &lt;input type="radio" id="button" value="first_button" name="6" /&gt;
   &lt;input type="radio" id="button" value="second_button" name="6" /&gt;
   &lt;input type="radio" id="button" value="first_button" name="7" /&gt;
   &lt;input type="radio" id="button" value="second_button" name="7" /&gt;
   &lt;input type="radio" id="button" value="first_button" name="8" /&gt;
   &lt;input type="radio" id="button" value="second_button" name="9" /&gt;
   &lt;input type="radio" id="button" value="first_button" name="9" /&gt;
   &lt;input type="radio" id="button" value="second_button" name="9" /&gt;
   &lt;input type="radio" id="button" value="first_button" name="10" /&gt;
   &lt;input type="radio" id="button" value="second_button" name="10" /&gt;
   &lt;/form&gt;
  </code></pre>
  
  <p>JAVASCRIPT</p>
  
  <pre><code> function Validation()
   {
   var bol2 = $("input:radio:checked").length;
   if (bol2&lt;=4)
     {
     alert("Please select 5 buttons");
     return false;
     }
   }
  </code></pre>
  
  <p>The code now works. Thanks @Climbage, I looked at other code and figured out what to do</p>