<figure>
<p>Hello please remove parent figure tag. I just want the this child p tag.</p>
</figure>
最佳答案
这是解决您问题的简单 Javascript 解决方案:
<html>
<body>
<figure id='x'><p id='y'>Hello</p></figure>
<script type='text/javascript'>
let a = document.getElementById('x').innerHTML;
document.getElementById('x').remove();
document.write(a);
</script>
</body>
</html>
关于javascript - 如何使用 JS 从 HTML 中删除特定标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61072276/