I'm trying to create a running total, unsuccessfully, what way would you do this:
var total = 0;
value = $('.price').text();
total += value;
$('#subtotal span').html(total);
All it does it add the next value to the "span" not actually add the figures together!
EDIT: From content of answer posted by OP.
$('.addtocart').click(function(){
$('#cart').show();
var omPartNo = $(this).next().text();
var supPartNo = $(this).next().next().text();
var cat = $(this).next().next().next().text();
var desc = $(this).next().next().next().next().text();
var manuf = $(this).next().next().next().next().next().text();
var list = $(this).next().next().next().next().next().next().text();
var disc = $(this).next().next().next().next().next().next().next().text();
var priceEach = $(this).next().next().next().next().next().next().next().next().text();
$('#cart table').append('<tr class="tableRow"><td><a class="removeItem" href="#"><img src="/admin/images/delete.png"></img></a><td>' + omPartNo + '</td><td>' + supPartNo + '</td><td>' + cat + '</td><td>' + desc + '</td><td>' + manuf + '</td><td>' + list + '</td><td>' + disc + '</td><td class="price">' + priceEach + '</td></tr>');
var total = 0;
value = parseInt($('.price').text(), 10);
total += value;
$('#subtotal span').html(total);
});
This is my complete code. I think i'm doing this wrong, this isnt going to give me a running total is it??
Any help!?