Mattka
Mattka

Reputation: 37

How Can I link several HTML files into a singular file

Im looking to figure out how to compile a couple of html pages into one page. like if i made a triangle in one html page, how would i link it with another html page that has a rectangle for example so that they both show up in one page. of course im not trying to figure out how to do this specifically but i want to generally know how to do it.

Upvotes: 0

Views: 50

Answers (1)

Vincent
Vincent

Reputation: 71

With jquery you can do it like so:

<html> 
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script> 
    $(function(){
      $("#includeContent").load("fileName.html"); 
    });
    </script> 
  </head> 

  <body> 
     <div id="includeContent"></div>
  </body> 
</html>

source: https://www.codegrepper.com/profile/abutahir

Upvotes: 1

Related Questions