Skip to content

re: How to replace arbitrary portions of HTML? VIEW POST


I'd suggest get the parent node using JS and then replace an entire node with another node that you've built.

parent.replaceChild(newNode, oldChild);

Manipulating DOM by replacing HTML could be dangerous if any JS is depending on any part of that.

code of conduct - report abuse