Home > Enterprise >  Is there a way to add code to HTML from other files? [closed]
Is there a way to add code to HTML from other files? [closed]

Time:10-02

I have a multi page website which uses the same navbar and everytime I want to change something to it I have to copy and paste everything that I have done to the other HTML files.Is there a way to have only one file where the code for the navbar is located and just import it to the other HTML files so when I change something to it, it also changes to all the other files ? (much like a React Component)

CodePudding user response:

Answer is "Yes" you can do it without React also. Look for the previous version of w3.js

see this example of how they are including

https://www.w3schools.com/howto/content.html

into another page

here is the existing working sample

https://www.w3schools.com/howto/tryit.asp?filename=tryhow_html_include_2

  • Related