I want to display a text to HTML by a javascript function. How can I escape html special chars in JS? Is there an API ?
Use this to remove HTML tags from string in JavaScript:
const strippedString = htmlString.replace(/(<([^>]+)>)/gi, ""); console.log(strippedString);