Newbie: Add up form fields by class?
Hi,
I'm new to Jquery and am trying to make this page work properly.
It's an order page. I was trying to do it with Javascript ... I know Jquery can do it much more easily, but I'm stuck.
I need to update each row's quantity field (.eachItemTotal) when an image (+/- , .priceTableBtn) is clicked. Then it will multiply .eachItemTotal by its cost (hidden field, #item1_cost, #item2_cost, etc. into hidden field #item1_total, #item2_total, class .eachItemTotal) and then sum up the totals and set #totalOrder to that sum. So far, only a bit of luck with Jquery. Got most of it working with Javascript but was hoping Jquery would be easier.
$('.priceTableBtn').click(function(){
var tot = 0;
$('.eachItemTotal').each(function() { tot += $(this).val(); });
$('#totalOrder').val(tot);
});
Help?
Thanks