Say I have an element like so:
<div id="color1" foo="test" class="yes">Hello</div>
I want to turn it into:
<span id="color1" foo="test" class="yes">Hello</span>
I thought to use wrap/unwrap, but not quite getting what I need.
Say I have an element like so:
<div id="color1" foo="test" class="yes">Hello</div>
I want to turn it into:
<span id="color1" foo="test" class="yes">Hello</span>
I thought to use wrap/unwrap, but not quite getting what I need.
Edit, removed g
modifier
from RegExp
var _s = $("div#color1").clone()[0].outerHTML.replace(/div/, "span");
$("div#color1").replaceWith(_s);