使用jQuery替换html标签替换
jQuery能够非常轻松地实现html标签替换,而这也将为我们带来更多新的可能。
$('p').replaceWith(function(){
return $("<div><div/>").append($(this).contents());
});
演示:
[runcode]
This is a paragraph.
This is another paragraph.
[/runcode]
参考http://www.w3school.com.cn/jquery/manipulation_replacewith.asp
