[jquery] jQuery limit to 2 decimal places

Possible Duplicate:
JavaScript: formatting number with exactly two decimals

How do I limit the following jQuery return to 2 decimal places?

$("#diskamountUnit").val('$' + $("#disk").slider("value") * 1.60);

I figure I've got to throw toFixed(2) somewhere into there, but I can't seem to get the ordering right or something.

This question is related to jquery

The answer is


Here is a working example in both Javascript and jQuery:

http://jsfiddle.net/GuLYN/312/

//In jQuery
$("#calculate").click(function() {
    var num = parseFloat($("#textbox").val());
    var new_num = $("#textbox").val(num.toFixed(2));
});


// In javascript
document.getElementById('calculate').onclick = function() {
    var num = parseFloat(document.getElementById('textbox').value);
    var new_num = num.toFixed(2);
    document.getElementById('textbox').value = new_num;
};
?