Skip to content

Instantly share code, notes, and snippets.

@himattm
Created February 26, 2015 01:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save himattm/c3cfde5399ea4ee99bb1 to your computer and use it in GitHub Desktop.
Save himattm/c3cfde5399ea4ee99bb1 to your computer and use it in GitHub Desktop.
Replace Text on HTML Page
var textToReplace = "Original";
var replacementText = "Replaced";
document.body.innerHTML = document.body.innerHTML.replace(new RegExp(textToReplace, "gi"), replacementText);
// "gi" in the RegExp is to make the replacement global and case insensitive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment