开发者

Remove html tags from string using jquery [duplicate]

This question already has answers here: Strip HTML from Text JavaScript (45 answers) Closed 9 years ago.

i want to know how to remove html tags from a string using jquery, html looks like this

var string = '<p><marquee> some text </marquee>/p>';

now i want to remove all html tags an开发者_StackOverflowd just want the plain text from it.

thank you


jQuery text() will help you like this :

var willbeequaltosometext = $("marquee").text();


You could do this yust like this:

$('<p><marquee> some text </marquee></p>').text()


try:

alert($('<li>Some text...</li>').text());
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜