Summing up values of checkboxes, with -minimum selected condition
<p>I have a form with X number of groups of checkboxes with price values. 
I have assigned one condition to each group. </p>

<p>Lets assume that we have 2 groups:</p>

<p>1st group condition: sum all the values together, except the first 3 selected 
(NOT the first 3 in the index but first 3 selected and every selection after that)</p>

<p>2nd group condition: sum all the values together, except the first 2 selected 
(NOT the first 2 in the index but first 2 selected and every selection after that)</p>

<pre><code>var minLimit1 = 3;
var minLimit2 = 2;

$(":input", "#myForm").each(function(){

    if(this.type == 'checkbox'){



    }

});
</code></pre>

<p>How can I implement that using jQuery or plain js?</p>

<p>EDIT: SAMPLE FORM CODE</p>

<pre><code>&lt;form id="myForm"&gt;
 &lt;fieldset class="required"&gt;
  &lt;input type="checkbox" value="1.30" name="group1" id="id-1"&gt;
  &lt;label for="id-1"&gt;&lt;span&gt;Component 1&lt;/span&gt;&lt;em&gt;(€1.30)&lt;/em&gt;&lt;/label&gt;

  &lt;input type="checkbox" value="1.00" name="group1" id="id-2"&gt;
  &lt;label for="id-2"&gt;&lt;span&gt;Component 2&lt;/span&gt;&lt;em&gt;(€1.00)&lt;/em&gt;&lt;/label&gt;

  &lt;input type="checkbox" value="0.50" name="group1" id="id-3"&gt;
  &lt;label for="id-3"&gt;&lt;span&gt;Component 3&lt;/span&gt;&lt;em&gt;(€0.50)&lt;/em&gt;&lt;/label&gt;

  &lt;input type="checkbox" value="0.25" name="group1" id="id-4"&gt;
  &lt;label for="id-4"&gt;&lt;span&gt;Component 4&lt;/span&gt;&lt;em&gt;(€0.25)&lt;/em&gt;&lt;/label&gt;

  &lt;input type="checkbox" value="1.75" name="group1" id="id-5"&gt;
  &lt;label for="id-5"&gt;&lt;span&gt;Component 5&lt;/span&gt;&lt;em&gt;(€1.75)&lt;/em&gt;&lt;/label&gt;

  &lt;input type="checkbox" value="2.00" name="group1" id="id-6"&gt;
  &lt;label for="id-6"&gt;&lt;span&gt;Component 6&lt;/span&gt;&lt;em&gt;(€2.00)&lt;/em&gt;&lt;/label&gt;
 &lt;/fieldset&gt;

 &lt;fieldset class="required"&gt;
  &lt;input type="checkbox" value="1.20" name="group2" id="id-7"&gt;
  &lt;label for="id-7"&gt;&lt;span&gt;Component 1&lt;/span&gt;&lt;em&gt;(€1.20)&lt;/em&gt;&lt;/label&gt;

  &lt;input type="checkbox" value="1.10" name="group2" id="id-8"&gt;
  &lt;label for="id-8"&gt;&lt;span&gt;Component 2&lt;/span&gt;&lt;em&gt;(€1.10)&lt;/em&gt;&lt;/label&gt;

  &lt;input type="checkbox" value="0.40" name="group2" id="id-9"&gt;
  &lt;label for="id-9"&gt;&lt;span&gt;Component 3&lt;/span&gt;&lt;em&gt;(€0.40)&lt;/em&gt;&lt;/label&gt;

  &lt;input type="checkbox" value="0.35" name="group2" id="id-10"&gt;
  &lt;label for="id-10"&gt;&lt;span&gt;Component 4&lt;/span&gt;&lt;em&gt;(€0.35)&lt;/em&gt;&lt;/label&gt;

  &lt;input type="checkbox" value="1.15" name="group2" id="id-11"&gt;
  &lt;label for="id-11"&gt;&lt;span&gt;Component 5&lt;/span&gt;&lt;em&gt;(€1.15)&lt;/em&gt;&lt;/label&gt;

 &lt;/fieldset&gt;
&lt;/form&gt;
</code></pre>

<p>Note: I want the latest clicked and further to be added in the summary, not the last in the index.</p>
