I have a page with three divs: container, side-nav, content.
I want to replace the HTML in the body div with the HTML in another (source) HTML file when I click a link in the side-nav.
index.html
<div class="float-container">
<div class="sidenav">
<a href="#about">About</a>
<a href="#services">Services</a>
<a href="#clients">Clients</a>
</div>
<div class="body">
<p>some text here.</p>
</div>
</div>
about.html
<h1>About Me</h1>
<p> yada yada yada</p>
2
Answers
The achieve this, use an
<iframe>
. HTML files can be directly loaded into iframes using the src attribute.In simple way, I usually do it with frameset.