title: Select only one checkbox out of three with same name
body: <p>UPDATE:</p>
  
  <p>My code now is something like this: (works).</p>
  
  <pre><code>   $(document).ready(function(){
           $("input:checkbox").click(function(){
  var group = "input:checkbox[name='"+$(this).attr("name")+"']";
  $(group).attr("checked",false);
  $(this).attr("checked",true);
   });
  
  
            });   
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>     &lt;input type="checkbox" name="swimming" class="chb" /&gt;
       &lt;input type="checkbox" name="swimming" class="chb" /&gt;
       &lt;input type="checkbox" name="swimming" class="chb" /&gt;
  </code></pre>
  
  <hr>
  
  <p>I have a questionnaire type form with three checkboxes for each question and I want the user to be able to select only one out of the three. </p>
  
  <p>My HTML is something like this:</p>
  
  <p>Question 1:</p>
  
  <pre><code>             &lt;input type="checkbox" name="ballet" /&gt;
               &lt;input type="checkbox" name="ballet" /&gt;
               &lt;input type="checkbox" name="ballet" /&gt;
  </code></pre>
  
  <p>Question 2:</p>
  
  <pre><code>             &lt;input type="checkbox" name="swimming" /&gt;
               &lt;input type="checkbox" name="swimming" /&gt;
               &lt;input type="checkbox" name="swimming" /&gt;
  </code></pre>
  
  <p>But this allows the user to select all checkboxes for a particular question. And I want it to be able to select only one out of the three. Is there a solution to this?</p>
  
  <p>Thanks</p>