Skip to content

Instantly share code, notes, and snippets.

@awendland
Last active August 29, 2015 14:22
Show Gist options
  • Save awendland/fd7470866fec05b387c9 to your computer and use it in GitHub Desktop.
Save awendland/fd7470866fec05b387c9 to your computer and use it in GitHub Desktop.
Reverse the textContents of an element in order to hide an email by pasting it in reverse in the source, but displaying it properly after the "unObscureElements" JS function runs.
<span class="obscure">moc.elpmaxe@eman</span> will become <span ...>[email protected]</span> after the JS runs
function unObscureElements() {
var oS = document.querySelectorAll('.obscure');
for (var oI = 0; oI < oS.length; oI++) {
var oE = oS[oI];
oE.textContent = obscured.textContent.split('').reverse().join('');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment