开发者

Remove html tags from string using jquery [duplicate]

开发者 https://www.devze.com 2023-04-07 00:15 出处:网络
This question already has answers here: Strip HTML from Text JavaScript (45 answers) Closed 9 years ago.
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

精彩评论

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