---
title: "How to replace a word in a string using JQuery?"  
description: "How to replace a word in a string using JQuery?"  
author: "Anonymous User"  
published: 2014-10-31  
updated: 2014-10-31  
canonical: https://www.mindstick.com/forum/2475/how-to-replace-a-word-in-a-string-using-jquery  
category: "jquery"  
tags: ["javascript"]  
reading_time: 1 minute  

---

# How to replace a word in a string using JQuery?

I've tried using replaceAll and replaceWith and they don't seem to work\
**for example, [string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp)**\
"~/Foo.aspx?fn=/image.jpg&[amp](https://www.mindstick.com/forum/156207/what-is-amp);p=[True](https://yourviews.mindstick.com/view/81326/boycott-chinese-products-dream-will-come-true)"\
I want to do is [replace](https://yourviews.mindstick.com/view/81330/cow-antibody-research-in-usa-a-step-ahead-to-replace-plasma-therapy) p=True with p=False\

```
var previewSource = "~/Foo.aspx?fn/image.jpg&p=True"var loadedSource =
$(previewSource).replaceAll("p=True").replaceWith("p=False");
```

## Replies

### Reply by Anonymous User

**You can use pure Javscript here:**

```
var previewSource = '~Foo.aspx?fn/image.jpg&p=True';var loadedSource = previewSource.replace("p=True", "p=False");
```


---

Original Source: https://www.mindstick.com/forum/2475/how-to-replace-a-word-in-a-string-using-jquery

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
