Is there a way to remove html tags from a string in JavaScript?

21,913

You can achieve this by JavaScript.

Try this!!

var plainText = content.replace(/<[^>]*>/g, '');

This will return you plain text.

Share:
21,913
Maurice
Author by

Maurice

love making webapplications with java, spring and angular.

Updated on November 09, 2020

Comments

  • Maurice
    Maurice over 3 years

    I am working with the rich text editor component of primeng. This editor turns everything i type in into html. But sometimes i want to output these texts in plain text instead. Does angular 2 provide a way to easily remove the html tags from the text?

    Thank you.