Skip to content

Instantly share code, notes, and snippets.

@kennethhutw
Created March 14, 2016 08:13
Show Gist options
  • Save kennethhutw/1ef3beb182c722203178 to your computer and use it in GitHub Desktop.
Save kennethhutw/1ef3beb182c722203178 to your computer and use it in GitHub Desktop.
converts HTML to text using Javascript
// converts HTML to text using Javascript
function html2text(html) {
var tag = document.createElement('div');
tag.innerHTML = html;
return tag.innerText;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment