Rich-text Reply

Replace all Instances of a Phrase

dstardom 11-11-15

Replace all Instances of a Phrase



We're trying to replace all instances of a phrase or word on a website with another phrase to test out which one resonates better with users. Can you let me know if anyone has experience with this or just ideas?


An example would be a T-Shirt company selling red shirts wanting to replace the word red with crimson. It would always be text (sometimes in a button), no images or anything like that.


I was thinking a replace() fuction.


Thank you!

Level 1

WFJAMES 11-12-15

Re: Replace all Instances of a Phrase

I managed to do this with product names using the below


Basically in every h1 replace the word longline with longer length this miight help you


$.each($('h1'), function(i,e) {
$(e).html($(e).html().replace(/Longline/g,'Longer Length'));

Level 2