I have an array called prices and another called orderT I want to check if it’s of a certain orderType then I do certain transactions with prices[i] if it’s a different type then another transaction (only 2 types of orders).
So far I can iterate through prices (using accounting.js plugin):
function processTotal(){
var prices = $('.prices');
var orderT = $('.orderType');
var total = 0;
$.each(prices, function(i, e){
total += accounting.unformat(prices[i].textContent);
});
total = parseFloat(total);
$('#sum').text(accounting.formatMoney(total, "€", 2, ".", ","));
}
the prices part works very well, but I can’t figure how to also go over the orderT to check.
EDIT
orderT and prices are related and are in a table, I can’t post all the table as it is quite big but it’s basically:
<td>order_type</td>
<td>$00.00</td>
Try this(assuming the number of .prices is same as .orderType):
Looks like the .price and .orderType are related. If you can post the HTML, this code can be improved to use the siblings/other selectors to access .price and corresponding .orderType