Last active
August 29, 2015 14:22
-
-
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.
This file contains 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
<span class="obscure">moc.elpmaxe@eman</span> will become <span ...>[email protected]</span> after the JS runs |
This file contains 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
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