Use div tag like iframe

css, html, iframe

Solution

You can do something like this:

jQuery

$("#nav a").on( "click", function(e) {

  e.preventDefault(); // prevent the default event, so it doesn't actually go to that page.
  var url = $(this).attr("href"); // this should be some-page.html in this example.

  $("#content").load( url ); // where we're adding the new html.

});

HTML

<ul id="nav">
    <li>
        <a href="some-page.html">Some page</a>
    </li>
</ul>

and

Also include:

<div id="content">
    content will be loaded here
</div>

Problem

I want to load different (about.html, home.html, pics...) HTML pages from my web directory into the `<div id="content">` by clicking links in the navigation `<div id="content">`. How can this be done? I'm new to CSS/HTML. I do not want to use `iframe`.

Original source