I am working with the jQuery Calculation Plugin on a page where I do quantity x price calculations that then add to a subtotal. This is repeated 4 times.
Each set of 4 involve fields with different ids and differing calculations (more than just price x qty).
The id’s of the 4 subtotal fields are subtotal_events, subtotal_raffle, subtotal_sdc, subtotal_late.
In addition to displaying the individual subtotals, I need to display a “grand total”…a total of the subtotals.
In the fiddle referenced below, I’ve hard-coded the values of two of the 4 subtotals.
I’ve also created a function recalc3, which is currently producing the NaN in the #grandtotal span. The value should be $70 based upon the hard-coded subtotals, even if no tours or extra tickets are ordered.
Hours of reading posts and trial and error aren’t getting me any closer, so any help with achieving the goal is very much appreciated.
Here’s the fiddle: http://jsfiddle.net/sadiem/7spHt/
You are trying to extract the text in SPAN element, but are using the $(this).val function.
Use $(this).text function and also remove the $ symbol in the text before parsing as float.
Updated jsFiddle: http://jsfiddle.net/7spHt/9/