JSFiddle - React, Tailwind, and code Playground

HTML

<table id="scLD">
    <tbody>
        <tr class="onHandTdmm2">
            <td>This row has class <strong>onHandTdmm2</strong></td>
            <td>5.25</td>
            <td>This should be added to the sum</td>
        </tr>
        <tr class="onHandTdmm3">
            <td>This row has class <strong>onHandTdmm3</strong></td>
            <td>10.45</td>
            <td>This should be added to the sum</td>
        </tr>
        <tr class="x">
            <td>This row has class <strong>x</strong></td>
            <td>25.00</td>
            <td>This should NOT be added to the sum</td>
        </tr>
        <tr class="onHandGrand">
            <td>This row has class <strong>onHandGrand</strong></td>
            <td>5.25</td>
            <td>This is the sum</td>
        </tr>
    </tbody>
</table>

CSS

table tr td {
    border: 1px solid black;
    padding: 20px;
}

table tr {
    background-color: lightgreen;
}

.x {
    background-color: pink;
}

.onHandGrand {
    background-color: lightblue;
}

JavaScript

var sum = 0;
$("#scLD > tbody > tr").each(function() {
    var $row = $(this);
    var $cell = $(this).find('td:nth-child(2)');

    if (/^onHandTdmm([0-9]+)$/.test($row.attr("class"))) {
        var y = parseFloat($cell.text(), 10) || 0;
        sum += y;
    }
    if ($row.hasClass("onHandGrand")) {
        $cell.html(sum);
        sum = 0;
    }
});