Skip to content

Instantly share code, notes, and snippets.

@bitboxx
Created January 13, 2014 15:11
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save bitboxx/8402000 to your computer and use it in GitHub Desktop.
Javascript function that convert HTML to plain text
// converts HTML to text using Javascript
function html2text(html) {
var tag = document.createElement('div');
tag.innerHTML = html;
return tag.innerText;
}
@pavitra22
Copy link

@lokeshrangineni
Copy link

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