Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. replace function in javascript not working in Firefox

replace function in javascript not working in Firefox

Scheduled Pinned Locked Moved ASP.NET
helpjavascript
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Johndas
    wrote on last edited by
    #1

    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

    L 1 Reply Last reply
    0
    • J 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

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups