I have multiple different text strings I need to replace on the client side.
Let's say I want to replace "Red Apple" with "Orange Orange" and "Sad Cat" with "Happy Dog".
I've been trying to extend this 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");
});
I'm finding that only the first replacement is returned.
I'm having trouble figuring out how to return multiples, not getting the desired result like this either.
return {
...
}
Rationale for this not being a duplicate: Note that I am not trying to replace just Apples but also Cats.