JSFiddle - React, Tailwind, and code Playground

by FishBasketGordo

HTML

<table id="stock-hotdogs">
    <tr>
        <td>Other data</td>
        <td class="subtotal">$1.00</td>
    </tr>
    <tr>
        <td>Other data</td>
        <td class="subtotal">$1.00</td>
    </tr>
    <tr>
        <td>Other data</td>
        <td class="subtotal">$1.00</td>
    </tr>
</table>

CSS

table, td { 
    border: solid 1px #000; 
    padding: 10px;
}

JavaScript

var subTotals = $('#stock-hotdogs td.subtotal');
var sum = 0;

subTotals.each(function() {
    sum += parseFloat($(this).text().substr(1));
});

alert(sum);