Created
February 5, 2021 09:00
-
-
Save Sanchithasharma/1688e0309d5725fe8ca636246713b7ad to your computer and use it in GitHub Desktop.
Convert HTML text to plain text
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
var myHTML= "<div><h1>Jimbo.</h1>\n<p>That's what she said</p></div>"; | |
var strippedHtml = myHTML.replace(/<[^>]+>/g, ''); | |
// Jimbo. | |
// That's what she said | |
console.log(stripedHtml); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment