Home > DeveloperSection > Forums > How to replace a word in a string using JQuery?
Chris S
Chris S

Total Post:48

Posted on    October-31-2014 12:36 AM

 JQuery JavaScript 

 1 Reply(s)
 668  View(s)
Rate this:
I've tried using replaceAll and replaceWith and they don't seem to work

for example, string


I want to do is replace p=True with p=False

var previewSource = "~/Foo.aspx?fn/image.jpg&p=True"

var loadedSource = $(previewSource).replaceAll("p=True").replaceWith("p=False");

Pawan Shukla
Pawan Shukla

Total Post:29

Posted on    October-31-2014 12:38 AM

You can use pure Javscript here:

var previewSource = '~Foo.aspx?fn/image.jpg&p=True';

var loadedSource = previewSource.replace("p=True", "p=False");

Modified On Mar-17-2016 04:14:08 AM

Don't want to miss updates? Please click the below button!

Follow MindStick