99
rated 0 times
[
106]
[
7]
/ answers: 1 / hits: 16024
/ 12 Years ago, fri, may 11, 2012, 12:00:00
How do I dynamically change the body content of an html page when a link is clicked?
So I have 3 html pages that looks like this:
<li><a id=homeContainer href=#>Home</a></li>
<li><a id=testContainer href='#'>test</a></li>
<li><a id=pageContainer href=#>page</a></li>
My div:
<div id='container'>
</div>
The javascript:
$( document ).ready( function() {
$( '#testContainer' ).click( function() {
$( '#container' ).load('test.html');
});
This works fine if i make for all pages a separate function. But how can I make the javascript function taking a page in the load()
function instead of hardcoding it?
[Edit]
I dropped my whole page with everything, html, javascript and css here:
jsfiddle
More From » html