title: Jquery - Sum of each same class li value
body: <p>Currently I'm Developing an Invoice app with php , mysql &amp; jquery. I want to show some details with jquery. I have dynamically created tables with dynamic data. </p>
  
  <pre><code>&lt;table class="report_table"&gt;
      &lt;tr&gt;
          &lt;td class="items_id"&gt;
              &lt;ul&gt;
                  &lt;li class="KKTF0"&gt;KKTF0&lt;/li&gt;
                  &lt;li class="PEN01"&gt;PEN01&lt;/li&gt;
              &lt;/ul&gt;
          &lt;/td&gt;
          &lt;td class="items_qty"&gt;
              &lt;ul&gt;
                  &lt;li class="KKTF0"&gt;1&lt;/li&gt;
                  &lt;li class="PEN01"&gt;2&lt;/li&gt;
              &lt;/ul&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  &lt;table class="report_table"&gt;
      &lt;tr&gt;
          &lt;td class="items_id"&gt;
              &lt;ul&gt;
                  &lt;li class="BKK01"&gt;BKK01&lt;/li&gt;
                  &lt;li class="KKTF0"&gt;KKTF0&lt;/li&gt;
                  &lt;li class="PEN01"&gt;PEN01&lt;/li&gt;
              &lt;/ul&gt;
          &lt;/td&gt;
          &lt;td class="items_qty"&gt;
              &lt;ul&gt;
                  &lt;li class="BKK01"&gt;4&lt;/li&gt;
                  &lt;li class="KKTF0"&gt;2&lt;/li&gt;
                  &lt;li class="PEN01"&gt;3&lt;/li&gt;
              &lt;/ul&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>li classes are dynamically created. my jquery code </p>
  
  <pre><code> jQuery(document).ready(function() {
      $('.report_table').each(function() {
          $('.items_id ul li').each(function() {
              $(this).addClass($(this).text());
              var className = $(this).attr("class");
              $(this).parents('tr').find('td.items_qty li').eq($(this).index()).addClass(className);
          });
      });
  });
  </code></pre>
  
  <p>I want this result</p>
  
  <pre><code>&lt;table&gt;
      &lt;tr&gt;
          &lt;th&gt;Item Id&lt;/th&gt;
          &lt;th&gt;Sum of Item&lt;/th&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;KKTF0&lt;/td&gt;
          &lt;td&gt;3&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;PEN01&lt;/td&gt;
          &lt;td&gt;5&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;BKK01&lt;/td&gt;
          &lt;td&gt;4&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I don't have any idea. please help me... Thanks.</p>