Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Emmanouil Koumortzis
Emmanouil Koumortzis
2,888 Points

links between my pages

I want to my page change only the main content when i choose a link from nav bar..where i learn this..?

Try looking at the videos on here for a start. Maybe AJAX but your question is sparse in details to say the least!

Jeremy Germenis
Jeremy Germenis
29,854 Points

or go old skool with some frames!

James Barnett
James Barnett
39,199 Points

Jeremy Germenis -

> or go old skool with some frames!

<frame> and related elements were removed in HTML5 because using them damages usability and accessibility

1 Answer

James Barnett
James Barnett
39,199 Points

You need to know basic JavaScript & JQuery, no AJAX necessary.

$(document).ready(function(){
  $("li").click( function() { 
    var classClicked = $(this).attr('class');
    $(".content div").removeClass( "show" );
    $(".content-" + classClicked).addClass("show"); 
  });
});

I made you a demo

Nice advice, but still AJAX would be better than all the content in a single HTML page

James Barnett
James Barnett
39,199 Points

Adam Sackfield - Where would the content live if not in the page. Database? JSON? PHP files?

JSON on the server!