jQuery: find and replace all the occurances from string

Example:

I have to replace the text “find” with text “replace” from the below string

“This is to find and replace the text with jquery find.”

strings = strings.replace(/find/g,"replace");

The output will be:
“This is to replace and replace the text with jquery replace.”

Advertisements
jQuery: find and replace all the occurances from string

7 thoughts on “jQuery: find and replace all the occurances from string

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s