I have the following calculation that I would like to format as a currency:
jQuery(function () {
$("#weight").change(function () {
var iva = $("#iva").val();
var subtotal = $("#subtotal").val();
var total = parseFloat(iva) + parseFloat(subtotal);
$("#total").val(total.toFixed(2));
})
})
I have tried the numeral.js plug in change the last line to:
$("#total").val(total.format('$0,0.00'));
but this is not working (no calculation at all.
What is the proper way to use the plugin in this instance?
Thanks for any help!