Why do I get an error message that .replace is not a function? [duplicate]
问题 This question already has answers here : var.replace is not a function (9 answers) Closed 4 years ago . I have this function: function countLitreKgSums(cProductIds){ var cLitreKgSums = new Array(); var cWeek = 0; for(i=0;i<cProductIds.length;i++){ var cLitreKgSum = 0; $("#plan_table td[class='week']").each(function(){ cWeek = $(this).html(); var cLitreKgValue = $("input[name*='plan_table_week" + cWeek + "_prod" + cProductIds[i] + "_']").val(); if (cLitreKgValue == "") { cLitreKgValue = 0; }