Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 22-06-2009
Member
 
Join Date: Jan 2009
Posts: 44
Javascript to replace plus sign

I have some text and using java script i need to replace the plus sign, so the question is Javascript to replace plus sign or any single character from a long text like for example :
Code:
firsttext+secondtext&thirdtext?fourthtext=firstvalue&firsttext+secondtext&thirdtext?fourthtext=secondvalue
From this text i want to replace all the plus sign, '?' sign, '&' sign and '=' sign how do i do it? Please help...
Reply With Quote
  #2  
Old 22-06-2009
Member
 
Join Date: May 2008
Posts: 2,008
Re: Javascript to replace plus sign

You will have to write a java script code for each character, example :

Code:
replace("+", "text").
replace("?", "text").
replace("&", "text").
replace("=", "text").
Reply With Quote
  #3  
Old 22-06-2009
Member
 
Join Date: Jan 2009
Posts: 44
Re: Javascript to replace plus sign

Thanks for replying that quick, really appreciate your help, but i already this method, doesn't help. This only replaces the first occurrence of the sign with the text but the later one remains as it is. Any other method? Please help!
Reply With Quote
  #4  
Old 22-06-2009
Member
 
Join Date: May 2008
Posts: 2,383
Re: Javascript to replace plus sign

Well did you try this method :


Code:
replace(/+/g, "text")
replace(/?/g, "text")
replace(/&/g, "text")
replace(/=/g, "text")
This might do the work...
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Javascript to replace plus sign"
Thread Thread Starter Forum Replies Last Post
Javascript to replace content of div Kalyug Software Development 7 20-05-2010 10:10 AM
JavaScript - location.replace Cordaro Software Development 6 13-05-2010 11:55 PM
javascript replace function not working Cornnelius Software Development 5 13-05-2010 12:12 AM
Javascript to replace all double quotes Amy Adams Software Development 5 12-05-2010 10:15 AM
How to replace HTML code using javascript visioneye Software Development 6 11-05-2010 11:38 PM


All times are GMT +5.5. The time now is 07:34 PM.