开发者

remove a set of characters from a script [duplicate]

This question already has answers here: Strip HTML from Text JavaScript (45 answers) 开发者_运维知识库 jQuery (almost) equivalent of PHP's strip_tags() (9 answers) Closed 9 years ago.

How to remove <p> and </p> from a text in javascript?

I have a string

 <p> This is a text</p>

and I want to remove the <p> and the </p>.

How can I do that in Javascript?


Use the replace() function.

For example: "<p> This is a text</p>".replace(/<\/?p>/g,"").

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜