Jquery group by td with same class
<p>I have the current table data:</p>

<pre><code>&lt;table&gt;     
&lt;tr class="Violão"&gt;
    &lt;td&gt;Violão&lt;/td&gt;
    &lt;td class="td2 8"&gt;8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class="Violão"&gt;
    &lt;td&gt;Violão&lt;/td&gt;
    &lt;td class="td2 23"&gt;23&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class="Guitarra"&gt;
    &lt;td&gt;Guitarra&lt;/td&gt;
    &lt;td class="td2 16"&gt;16&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
</code></pre>

<p>What I want to do is groupby the TDs which are the same, and sum the values on the second td to get the total. With that in mind I´ve  put the name of the product to be a class on the TR (don't know if it is needed)</p>

<p>and I've coded the current javascript:</p>

<pre><code>$(".groupWrapper").each(function() {
              var total = 0;
              $(this).find(".td2").each(function() {

                total += parseInt($(this).text());
              });
              $(this).append($("&lt;td&gt;&lt;/td&gt;").text('Total: ' + total));
            });
</code></pre>

<p>by the way the current java scripr doesn't groupby.</p>

<p>Now i'm lost, I don't know what else I can do, or if there is a pluging that does what I want.</p>
