Replace is not a function error

To correct invoice details page issue is only for invoice with status unapproved payment status. The invoicedetailview is extended for an update.

There showing an error replace is not a function error ” jQuery.Deferred exception: amount.replace is not a function TypeError: amount.replace is not a function”.

amount = amount.replace(/,/g, ”); code was getting error

To solve the error, convert the value to a string, or check if the value is of type string before calling the replace() method.

var filter_list =["abcd","efgh"];
filter_list = filter_list.toString().replace(/,/g, ' AND filter:');
console.log(filter_list)

For correcting the issue used code.

amount = parseFloat(amount.toString().replace(/,/g, ”));

Leave a comment

Your email address will not be published. Required fields are marked *