Skip to content

Instantly share code, notes, and snippets.

@ricealexander
Created January 31, 2020 21:15
Show Gist options
  • Save ricealexander/6b1be6c6002a4c7b6c934336cb29bcfe to your computer and use it in GitHub Desktop.
Save ricealexander/6b1be6c6002a4c7b6c934336cb29bcfe to your computer and use it in GitHub Desktop.
Strip HTML Tags
const stripTags = string => {
const temp = document.createElement('div')
temp.innerHTML = string.replace(/<br[^>]*>/gi, ' ')
return temp.textContent
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment