Note that there are some explanatory texts on larger screens.

plurals
  1. POremove item from "running total" in jQuery
    primarykey
    data
    text
    <p>This is my code for a shopping cart (the total so far, but a shopping cart eventually) i'm trying to put the code in to minus the clicked item's value from the "total", this is my code:</p> <pre><code>$('.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('&lt;tr class="tableRow"&gt;&lt;td&gt;&lt;a class="removeItem" href="#"&gt;&lt;img src="/admin/images/delete.png"&gt;&lt;/img&gt;&lt;/a&gt;&lt;td&gt;' + omPartNo + '&lt;/td&gt;&lt;td&gt;' + supPartNo + '&lt;/td&gt;&lt;td&gt;' + cat + '&lt;/td&gt;&lt;td&gt;' + desc + '&lt;/td&gt;&lt;td&gt;' + manuf + '&lt;/td&gt;&lt;td&gt;' + list + '&lt;/td&gt;&lt;td&gt;' + disc + '&lt;/td&gt;&lt;td class="price"&gt;' + priceEach + '&lt;/td&gt;&lt;/tr&gt;'); var total = 0; $('.price').each(function() { total += parseFloat($.text([this])); }); $('#subtotal span').html(total.toFixed(2)); }); $('.removeItem').live('click',function(){ $(this).closest('tr').remove(); }); </code></pre> <p>So when i click the .removeItem i need it to subtract from the "subtotal span" if possible??</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload