How to Load HTML-File in Div Element

preview_player
Показать описание
Hi, I'm Wesley. I'm a brand ambassador for Kinde (paid sponsorship). I'll help you master the latest tech here:

In this tutorial you’ll learn how to load an HTML-file or snippet into a div.

💻 Premium Courses:

0:00 Solution

#webdevelopment #coding #programming
Рекомендации по теме
Комментарии
Автор

Great tutorial. You saved me alot of time.

benjaminronns
Автор

I have done this using vanilla javascript and PHP but my problem is that the scripts from old contents are affecting newly loaded scripts? like existing object, event listener on old scripts etc is there a workaround for that? thank you

FCD
Автор

That is handy only when there is an onClick-function conveniently in use. But if you try to load a separate html-file into a section, it won't run any JavaScript code on load 😭 My page has a main section where all the content is loaded from the navBar links. One page has a section within, so it becomes a section inside a section. And that's when the problems start and nothing can be run from that html file automatically 🤔 I need it to load content like yours "this is snippet-1" so the user sees that immediately on page load. But it's not possible in 2023.

zumbalexxo