DEV Community

Discussion on: How to replace arbitrary portions of HTML?

Collapse
 
deepu105 profile image
Deepu K Sasidharan

You can replace parts of HTML either as string or by Dom manipulation and insert them back. But if you replace a node its children will be affected but not its siblings and parent. For example you can fetch the head part and manipulate it and insert it back. Same for header in your sample. I would recommend manipulating DoM rather than working with strings