最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Remove HTML tag and keep text - Stack Overflow

programmeradmin0浏览0评论

Is there a way to remove the HTML blockquote tag, but keep the text? Basically, if in my code was <blockquote>Hello!</blockquote>, I'd want it to display as Hello! - I don't know if there's a way to filter the blockquotes out or just clone the text, but an answer would be quite helpful!

Is there a way to remove the HTML blockquote tag, but keep the text? Basically, if in my code was <blockquote>Hello!</blockquote>, I'd want it to display as Hello! - I don't know if there's a way to filter the blockquotes out or just clone the text, but an answer would be quite helpful!

Share Improve this question edited Oct 16, 2012 at 22:23 VisioN 146k34 gold badges287 silver badges289 bronze badges asked Jul 3, 2012 at 22:26 James Charless DickinsonJames Charless Dickinson 4465 gold badges17 silver badges42 bronze badges 1
  • So you want to remove the HTML tag, and keep the text? – c0deNinja Commented Jul 3, 2012 at 22:28
Add a ment  | 

2 Answers 2

Reset to default 11

Use contents with unwrap:

$("blockquote").contents().unwrap();

You can use .html() to achieve this

$("blockquote").html()

Check out this running example

发布评论

评论列表(0)

  1. 暂无评论