How can I replace the html tag with a new tag using jQuery?
I have many table tags and I want to replace a specific table containing a class. All of its’ child nodes should be replaced too.
<table class='replace_this'>
<tr>
<td>
All table, tr, and td tag are replaced with div tag
</td>
</tr>
</table>
Should be changed to:
<div class='replace_this'>
<div>
<div>
All table, tr, and td tag are replaced with div tag
</div>
</div>
</div>
You have to start from the inside out:
Example