Created
January 13, 2014 15:11
-
-
Save bitboxx/8402000 to your computer and use it in GitHub Desktop.
Javascript function that convert HTML to plain text
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
// converts HTML to text using Javascript | |
function html2text(html) { | |
var tag = document.createElement('div'); | |
tag.innerHTML = html; | |
return tag.innerText; | |
} |
pavitra22
commented
Jun 23, 2015
This code is having XSS security issue.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment