【发布时间】:2014-07-02 14:49:52
【问题描述】:
我有一个问题,因为我想将页面中的所有跨度替换为标记 b。
这是演示,但很糟糕。要更改所有跨度,我必须在按钮上单击 2 次p>
jquery:
$('#myButton').click(function(){
$("span").replaceWith(function(){
return $("<b>" + $(this).html() + "</b>");
});
});
HTML:
<span>fdfdfd <span>hytrytryrt</span> fdfdfdf</span>
<button id="myButton">Change my link to a span</button>
这里是链接:
【问题讨论】:
-
你需要在问题中发布代码,不要只是分享链接
-
Arun P Johny,非常感谢。它有效:D
标签: javascript jquery html dom