Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I remove HTML tag from JSON

I have JSON file like

[{"description":"<p> example...</p> </br> <p>paragraph... </p> <div id="test" class="test2" style="left: -10000px; top: 10px; position:absolute;"> <p>paragraph... </p> "}]

So how can I remove the HTML tage such as <p> </p> </br> to display in ionic-framework

like image 704
Usman Avatar asked Mar 13 '26 20:03

Usman


1 Answers

If you can't use an HTML parser oriented solution to filter out the tags, here's a simple regex for it.

var noHTML =  OriginalString.replace(/(<([^>]+)>)/ig,"");

Here is the working plunker

like image 170
ngLover Avatar answered Mar 16 '26 11:03

ngLover



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!