Is this possible?
example:
$('a.change').click(function(){
//code to change p tag to h5 tag
});
<p>Hello!</p>
<a id="change">change</a>
So clicking the change anchor should cause the <p>Hello!</p>
section to change to (as an example) an h5 tag so you'd end up with <h5>Hello!</h5>
after the click. I realize you can delete the p tag and replace it with an h5, but is there anyway to actually modify an HTML tag?
I came up with an approach where you use a string representation of your jQuery object and replace the tag name using regular expressions and basic JavaScript. You will not loose any content and don't have to loop over each attribute/property.
Finally, you can replace the existing object/node as follows: