删除< b>文字标签 [英] Remove <b> tag from text
本文介绍了删除< b>文字标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用Greasemonkey使粗体文本变为非粗体.我只找到了一种方法来删除标签及其文本,但没有找到一种方法来简单地删除标签本身.
I want to make a bold text non-bold using Greasemonkey. I have only found ways to remove the tag along with its text, but not a way to simply remove the tag itself.
那我怎么做
<b>
some text
</b>
只是
some text
?
推荐答案
假定每个B标签内只有一个TextNode.
Assuming you've only one TextNode inside each B tag.
b.parentNode.replaceChild(b.firstChild, b);
示例: http://jsfiddle.net/DGTh5/
这篇关于删除< b>文字标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文