I have a variety of different text strings that I need to swap out on the client side.
For example, let's say I need to replace "Red Apple" with "Orange Orange" and "Sad Cat" with "Happy Dog".
I've been working on enhancing this particular question to handle multiple replacements.
$("#container h3 a").text(function () {
return $(this).text().replace("Red Apple", "Orange Orange");
return $(this).text().replace("Sad Cat", "Happy Dog");
});
However, I'm running into an issue where only the first replacement is being returned.
I am struggling to figure out how to return more than one replacement. The code snippet above is not achieving the desired outcome.
return {
...
}
The reason why this is not considered a duplicate: I am not just trying to replace instances of Apples, but also Cats.