JSFiddle - React, Tailwind, and code Playground

HTML

<table>
  <tbody>
    <tr id="tr_affiliation_15159">
      <td class="right col_aff_amount">15.00</td>
    </tr>
    <tr id="tr_affiliation_15189">
      <td class="right col_aff_amount">15.00</td>
    </tr>
  </tbody>
  <tfoot>
    <tr>
      <td class="total"></td>
    </tr>
  </tfoot>
</table>

JavaScript

var total = 0;

$('.col_aff_amount').each(function() {
      // i have tried .text(), and .html() as well as .val() but it doesn't seem to make any difference
      var val = parseFloat($(this).text(), 10);
      console.log(val);
      total += val;
  });


alert(total)