简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM