Created
February 26, 2015 01:10
-
-
Save himattm/c3cfde5399ea4ee99bb1 to your computer and use it in GitHub Desktop.
Replace Text on HTML Page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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