How to... Add values to the shopping cart UI

How to... Add values to the shopping cart UI

Hi All,

I am having problems adding values to the shopping cart UI. For some reason, the method i am using doubles the value. So if item value is 10, the total updates to 20.

Demo: http://bit.ly/947OpO
jQueryUI: http://jqueryui.com/demos/droppable/#shopping-cart


I have created a function called calcTotal() which is fired when the item has been dropped into the cart.

  1. function calcTotal()
                                    {
                                    var total = 0;
                                                                   
                                        $("li.input3").each(function()
                                        {
                                            //This happens for each checked input field
                                            var value = $(this).attr("value");
                                            //alert(value);
                                            total += parseInt(value);
                                        });
                                        $("p.total").html("Total: <strong>" + total + "</strong>");
                                                                       
                                   
                                    }
























    • Topic Participants

    • info