I have a tbody with several tr of these:
<tr class="odd">
<td class="id-despesa">
<p class="orig">
<?php echo $exibe2->id ?>
</p>
</td>
<td class="data-despesa">
<p class="orig">
<?php echo $exibe2->data ?>
</p>
</td>
<td class="funcionario-despesa">
<p class="orig">
<?php echo $exibe2->funcionario ?>
</p>
</td>
<td class="valor-rep">
<p class="orig">
<?php echo $exibe2->valorRep ?>
</p>
</td>
</tr>
As you can see, the table data is being pulled from the DB, but what I need is to add all the values of the td's with class rep-value where official- / strong> is equal to "x". It would be the equivalent of this in PHP: SELECT value-rep FROM table WHERE official-expense == 'x' and then sum all the received values, I think they managed to understand what he meant by this comparison.
I already have a function to add all values of rep-value as you can see:
var valorComSoma = 0;
$('#boxCom .valor-rep').each(function (i) {
valorComSoma = parseFloat($(this).text().replace(/[^0-9]/g, '')) +valorComSoma;
});
I'd rather have to add a filter to this function or something like that, as I mentioned earlier.