For example I have this HTML:
<body>
<div>Text</div>
</body>
And I would like to change the div
to something else like p
.
This is what I have tried but doesn't works:
var div = document.getElementsByTagName("div")[0]; // Get Element
div.nodeName = "p"; // Change It's Node Name to P
Please no libraries, and I don't really want to replace the actual div with a new p :)