Possible Duplicate:
JavaScript: formatting number with exactly two decimals
Getting a bit muddled up using variables and now cant seem to get calculation to work at all!?
$("#discount").change(function(){
var list = $("#list").val();
var discount = $("#discount").val();
var price = $("#price");
var temp = discount * list;
var temp1 = list - temp;
var total = parseFloat($(this).temp1()).toFixed(2);
price.val(total);
});
$(this).temp1()looks particularly out of place, I think you just meant to use thetemp1variable. Since it’s already a number, you don’t need to useparseFloaton it either: