Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法删除 HTML 块引用标签,但保留文本?基本上,如果在我的代码中是<blockquote>Hello!</blockquote>,我希望它显示为Hello!- 我不知道是否有办法过滤掉块引用或只是克隆文本,但答案会很有帮助!
<blockquote>Hello!</blockquote>
Hello!
contents与 一起使用unwrap:
contents
unwrap
$("blockquote").contents().unwrap();
您可以使用.html()来实现这一点
.html()
$("blockquote").html()
查看这个运行示例