const originalString = ` <div> <p>Hey that's <span>somthing</span></p> </div> `; const strippedString = originalString.replace(/(<([^>]+)>)/gi, ""); console.log(strippedString);
Reference:
https://css-tricks.com/snippets/javascript/strip-html-tags-in-javascript/
Article ID: 47
Created On: Sat, Oct 3, 2020 at 1:11 PM
Last Updated On: Sat, Oct 3, 2020 at 1:11 PM
Authored by: Saeed Nobakht [[email protected]]
Online URL: https://www.navel.ir/article/strip-html-tags-in-javascript-47.html