Home >Web Front-end >JS Tutorial >Inject HTML snippet from file

Inject HTML snippet from file

Susan Sarandon
Susan SarandonOriginal
2024-11-07 08:18:03317browse

A question on stackoverflow:

Include another HTML file in a HTML file

I was playing around and came up with a clean way to do it with:
1) Reading a content of the file with fetch()
2) Rendering a DOM Node from string
3) Replacing