rounding to 2 decimal places
i have a little script that counts the total of a column in a table
- $(function () {
var TotalCoreProd = 0;
$("[id*=col01]").each(function () {
TotalCoreProd = TotalCoreProd + parseFloat($(this).html());
});
$("[id*=TotalCoreProd]").html(TotalCoreProd.toString());
});
problem is, it's outputing the value with about 20 decimal places.
i need to round this to 2 decimal places.
i believe ".tofixed(2)" should be used, but no matter where i try and place it, it ends up causing the code the fail completely.