Unable to perform sum on cloned,appended and intertedAfter elements?

I have written some code in jQuery to calculate total number value of the divs that have been moved inside div.cart using the insertAfter function. However jquery refuses to return the sum.

The same code works if i use it to calculate sum while div.product are inside the original container and have not been clicked on yet. Why ? What am i doing wrong ?

NOTE : My goal is to only calculate sum of div’s with .price class that have been moved inside div.cart by clicking on them.

Please see the issue here : http://jsfiddle.net/5r1t387v/

Your sum isn’t inside your function.
Also insertAfter doesnt put the item INSIDE the cart. It puts it AFTER. Hence…‘insertAFTER’

Thank you issue is now solved !
I am updating JS fiddle for reference : http://jsfiddle.net/c815xjhw/

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.