Last active
December 30, 2019 13:39
-
-
Save alimd/6093934 to your computer and use it in GitHub Desktop.
Easy method for convert HTML Entities with javascript
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 esc = document.createElement('textarea'); | |
function escapeHTML(html) { | |
esc.innerHTML = html; | |
return esc.innerHTML; | |
} | |
function unescapeHTML(html) { | |
esc.innerHTML = html; | |
return esc.value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment