i have a question, can i replace html tag to another ?
But i don\'t want to make the content blank. like this:
content<
2018 Update:
Use ChildNode.replaceWith() method. As exemplified in MDN docs:
var parent = document.createElement("div");
var child = document.createElement("p");
parent.appendChild(child);
var span = document.createElement("span");
child.replaceWith(span);
console.log(parent.outerHTML);
// ""
More information in the this answer:
Please beware that it as July 2018 is an experimental technology and not supported by IE.