I have the following class that selects what's inside td.lineitemtotal cells and uses it in the getTotal function to get the total number of cells. But I do not want the function to use lines that are in tr.line_item_row with style = "display: none;" attribute.
$(document).ready(function() {
var line = $('.item');
getLineItemTotals(line);
var line_totals = $('.lineitemtotal');
getTotal(line_totals);
});
function getTotal(lines) {
var total = 0;
$.each(lines, function(){
total += parseFloat($(this).html());
});
$('#total-price').html('$' + total.toFixed(2));
}
source
share