Why I can't perform the toFixed() function after the sum of 2 retrieved values?
问题 Into a JQuery script I have the following problem trying to use the toFix() JavaScript method on a number. So I have the following situation: var anticipoProgetto = $("#valoreAnticipo").text(); var saldoProgetto = $("#valoreSaldo").text(); var anticipoCalcolato = (saldoProgetto + anticipoProgetto); console.log("ANTICIPO CALCOLATO: " + anticipoCalcolato); anticipoCalcolato = anticipoCalcolato.toFixed(2); $("#anticipoModaleUlterioreSaldo").val(anticipoCalcolato); The console.log() show: