Created
January 30, 2012 13:55
-
-
Save alexgibson/1704513 to your computer and use it in GitHub Desktop.
return text content from HTML
This file contains 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
//return text content from html | |
function stripHTML(html) { | |
var tmp = document.createElement('div'); | |
tmp.innerHTML = html; | |
return tmp.textContent || tmp.innerText; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment