I'm trying to figure out how to write a script where when a link is clicked in the left nav column, it will display text in the right main column. So, when you first arrive to the page, nothing will appear in the main portion of the site. Content only appears after clicking on a link. When you click on another link, the previous content is hidden, and the new text is displayed. Here's what I have so far:
This is great. Thanks for posting. So in your six-line block of code above...
Line 1 basically says we're going to create a function for any time a "#menu a" item is clicked. Line 2 hides all divs, even the one that was clicked, at least momentarily. Line 3 declares a new temporary variable.
Questions about line 3:
Is line 3 necessary to locate the ".main" div? Is it basically saying, "Go back up the CSS ladder all the way to the index level, so we can then drill down and find the ".main" div, as instructed in line 4?
If the "#menu a" div, was more deeply nested, would line 3 still work?
Line 4 identifies the corresponding div and shows it. Line 5 closes the function Line 6 is there to hide all divs to begin with. This line could also go above the function.