Created
July 26, 2015 12:28
-
-
Save JavaScript-Packer/b1efe70808171bc9e3a9 to your computer and use it in GitHub Desktop.
Encode HTML entities for every character in a string - Demo on http://jsfiddle.net/mjytsf60/
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
<textarea id=loader rows=11 cols=77></textarea> | |
<script> | |
function encodeHTMLentities(w){return w.replace(/[^]/g,function(w){return '&#'+w.charCodeAt(0)+';'})} | |
loader.value=encodeHTMLentities(document.body.innerHTML) | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment