Scroll to spot on page

After a user logs in, I want to take them back to the Comments section on my Article page.

How do I do that when I do not want to take them to a link?

I tried adding an anchor in an Heading like this, but NetBeans complains…

<h3  name="comments">Comments</h3>

Thanks,

Debbie

You can simply anchor an element by an id, E.g. you can use xxx.com/mypage.php#comments then use the below

<h3 id="comments">Comments</h3>

Oh, okay. I was trying to use name instead.

Sounds good.

Thanks,

Debbie

As Chris said, the selector (id) will help in achieving what you need. You can also use jQuery to smoothen the scrolling (or jumping).

Yes, the name= setup is outdated now. This is one of the main uses for ids (along with JS hooks). I don’t use ids for styling at all now.