title: Limit the number of checks that can be done to a set of checkboxes base of the value of a checked radio button
body: <p>How can I limit the number of checks that can be done to a set of checkboxes based of the value of a checked radio button.</p>
  
  <p>Say I have 3 options radio buttons.</p>
  
  <pre><code>Option 1 with value of 1 
  Option 2 with value of 2
  Option 3 with value of 3
  </code></pre>
  
  <p>Then I have 3 checkboxes.</p>
  
  <pre><code>Checkbox 1
  Checkbox 2
  Checkbox 3
  </code></pre>
  
  <p>By default checkbox is disabled without any radio buttons checked.
  If I check Option 1 Radio button - All checkboxes is enabled and I must and only choose 1 out of the 3
  If I check option 2 Radio Button - All checkboxes is enabled and I must and only choose 2 out of the 3 
  If I check Option 3 Radio Button - All checkboxes is enabled and I must choose all the checkbox.</p>
  
  <p>I have something i started using JSFiddle but i'm not so good with Javascript and needed some help..</p>
  
  <p><strong>Update:</strong> <a href="http://jsfiddle.net/wF38X/" rel="nofollow">http://jsfiddle.net/wF38X/</a></p>
  
  <pre><code>&lt;div id="radioButtons"&gt;
      &lt;input type="radio" name="quantity" id="radio1"&gt;
      &lt;input type="radio" name="quantity" id="radio2"&gt;
      &lt;input type="radio" name="quantity" id="radio3"&gt;
  &lt;/div&gt;&lt;!-- radioButtons --&gt;
  &lt;hr /&gt;
  &lt;div id="checkBoxes"&gt;
      &lt;input type="checkbox" name="color"&gt;
      &lt;input type="checkbox" name="color"&gt;
      &lt;input type="checkbox" name="color"&gt;
  &lt;/div&gt;&lt;!-- checkBoxes --&gt;​
  </code></pre>