JQuery each count result error -
I have a button that ends with the last tr in a table. Every time this happens, it is used to work together using the
mainTotalCalc () .
Total
.each is used and classes are used.
This problem occurs when I reach a final line balance. The total will be in the form of the last total it never gets. 0.00
Now I think I can see why, because JQ considers the last total in each variable.
I fully calculate that I am stuck about how to overthrow the last remaining line.
JS / JQ
function mainTotalCalc () {/ p> var activetableID = $ ( "li.till_table_button. active"). attr ('id'); // Alert (active); Var Tableclerk = $ ("#" + Activation). Data ("TableRF"); // Alert (Tablenumber); // test var newtotal = 0, total = 0; $ ('._______' + tablenumber + '_ row__totalprice'). Each (function (i) {var number = $ (this) .text (); // warning (content); // num = parseInt (number); num = ParseFloat (number); newtotal + = num; // alerts (Number); // test totalpriceDecimal = newtotal.toFixed (2); $ ('# till__totalpanel_table _'+ tabomber +' _ price '). Html (newtotal.toFixed (2)); // warning (totalpriceDecimal); i ++;}); }
before the final zero
After the last zero (total should remain in 1.00 and should not be)
If there are no more lines, then a guard position Set:
if ($ ('._______________________' _ '=) 0 ($ #);' html '(' 0.00 ');
Comments
Post a Comment