Created
January 6, 2021 06:08
-
-
Save hansamlin/6169bfd54a486623df6cfccb0b40946c to your computer and use it in GitHub Desktop.
Remove html tag via js
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
function strip(html){ | |
let doc = new DOMParser().parseFromString(html, 'text/html'); | |
return doc.body.textContent || ""; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment