In my efforts to solve a rounding problem I’ve broken the dynamic updating of totals that was previously working fine.
If you look at this JSFiddle:
http://jsfiddle.net/fmdataweb/73Jzc/1/
you will see as you change the select menu and add new rows and data the totals for moderate and high update dynamically. If you change a selection from high to moderate they continue to update.
I updated the script to fix a rounding issue in the totals which you can see at this JSFiddle:
All I did was change:
$('#textfield6').val(tot.moderate);
$('#textfield7').val( tot.high );
to:
$('#textfield6').val(tot.moderate.toFixed(1));
$('#textfield7').val( tot.high.toFixed(1) );
and that appears to have stopped the dynamic totals from updating and I’m not sure why.
define
totwith default-values for high and moderate:otherwise you will get an error when either high or moderate isn’t selected in any list