Strip HTML from Text JavaScript

前端 未结 30 3583
北荒
北荒 2020-11-21 05:08

Is there an easy way to take a string of html in JavaScript and strip out the html?

30条回答
  •  灰色年华
    2020-11-21 05:15

    For easier solution, try this => https://css-tricks.com/snippets/javascript/strip-html-tags-in-javascript/

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

提交回复
热议问题