How do I change an element (e.g. h1 -> h2) using jQuery / plain old javascript?
<p>Of course, there are a whole range of possible errors relating to document validity, but my immediate stumbling block occurs when changing a paragraph (<code>p</code>) into an <code>address</code> element. My current method is (more-or-less):</p>

<pre><code>var p = $('p#test');
p.replaceWith('&lt;address&gt;' + p.html() + '&lt;/address&gt;');
</code></pre>

<p>but that fails for this specific case; it works perfectly for p -> blockquote or h2 -> h3. Firebug suggests that a self-closing element (<code>&lt;address/&gt;</code>) has been added to the document, for some reason.</p>

<p>Can anyone spot the bug or suggest an alternative method?</p>
