replace function in javascript not working in Firefox
-
Hi all, i am not sure, this is right place to post. replace function is not working in Firefox,but it working in IE browser. for eg: var total ; total = total.replace(/,/,''); i am get the in Error console that replace is not function. can you please help me. thanks in advance.
JohnDas
-
Hi all, i am not sure, this is right place to post. replace function is not working in Firefox,but it working in IE browser. for eg: var total ; total = total.replace(/,/,''); i am get the in Error console that replace is not function. can you please help me. thanks in advance.
JohnDas
I tested the below script and it worked fine in IE and Firefox
var visitorName = "Chuck"; var myOldString = "Hello username! I hope you enjoy your stay username."; var myNewString = myOldString.replace("username", visitorName); document.write("Old string = " + myOldString); document.write("<br />New string = " + myNewString);
Johndas wrote:
total = total.replace(/,/,'');
Why your are using two commas, that means you are passing three arguments to function. Where replace accepts only two.