Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

commented Jun 23, 2015

@lokeshrangineni

This comment has been minimized.

Copy link

commented Jun 9, 2016

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
You can’t perform that action at this time.