named anchor not working

Melody Scott
Melody Scott used Ask the Experts™
on
http://www.magickitchen.com/sitemap.html

Hi- I took this through the validator and made the suggested changes, but it broke the look of the page, so I took it back. There are only a few errors.

At the top, the four words:

    About MagicKitchen.com
    HomeStyle Menu
    MK Meals Special Diet Menu
    Articles
    Health News
Are linked to <section id="sec1">  etc.

For instance, I have: <li role="presentation"><a href="#sec5">Health News</a></li> and <section id="sec5">.

What's wrong? Thanks.

But they aren't linking.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2011
Top Expert 2016
Commented:
See near line 630...
<script>
// Adds active state to secion navigation
$('.nav li').click(function(e) {
  e.preventDefault();
  $('.nav li').removeClass('active');
  $(this).addClass('active');
});
</script>

Open in new window

e.preventDefault() tells the browser to ignore the standard actions associated with these DOM elements.  Try removing that line and see if it helps.

Author

Commented:
That was it, thanks!! I am taking a javascript course this week, I hope to bother you guys less!
Most Valuable Expert 2011
Top Expert 2016

Commented:
Great!

"Bother us" any time -- we're glad to help :-)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial