Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7925883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:29:17+00:00 2026-06-03T18:29:17+00:00

I am workign on a site that is using a listener for the hash

  • 0

I am workign on a site that is using a listener for the hash to show and hide content DIVs and to scroll to the named anchor of the same name.

I was having a weird issue where instead of scrolling to the anchor, it would scroll to the DIV with the ID the same as the anchor’s name.

Once I changed the DIV ID to something different, the behavior was as expected.

I can’t seem to find any documentation on this and was wondering if this is documented behavior.

Code that works:

<a name="top">top</a>

<p id="bottomx" style="height: 1800px;">
<a href="#top">top</a>
<a href="#bottom">bottom</a>
<br>
</p>
<a name="bottom">bottom</a>

Not working as expected:

<a name="top">top</a>

<p id="bottom" style="height: 1800px;">
<a href="#top">top</a>
<a href="#bottom">bottom</a>
<br>
</p>
<a name="bottom">bottom</a>

In the second example, it would scroll to the P named “bottom”. Likewise, if I make a DIV at the bottom of the page with an ID of “bottom” and I hit page.html#bottom, it scrolls down to that DIV.

Just seems confusing. An idea why this is working this way? Same behavior in Safari and FF.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T18:29:18+00:00Added an answer on June 3, 2026 at 6:29 pm

    id has precedence over name:

    For HTML documents (and HTML MIME types), the following processing
    model must be followed to determine what the indicated part of the
    document is.

    1. Parse the URL, and let fragid be the component of the
      URL.

    2. If fragid is the empty string, then the indicated part of the
      document is the top of the document; stop the algorithm here.

    3. Let decoded fragid be the result of expanding any sequences of
      percent-encoded octets in fragid that are valid UTF-8 sequences into
      Unicode characters as defined by UTF-8. If any percent-encoded
      octets in that string are not valid UTF-8 sequences (e.g. they
      expand to surrogate code points), then skip this step and the next
      one.

    4. If this step was not skipped and there is an element in the DOM that
      has an ID exactly equal to decoded fragid, then the first such
      element in tree order is the indicated part of the document; stop
      the algorithm here.

    5. If there is an a element in the DOM that has a name attribute whose
      value is exactly equal to fragid (not decoded fragid), then the
      first such element in tree order is the indicated part of the
      document; stop the algorithm here.

    6. If fragid is an ASCII case-insensitive match for the string top,
      then the indicated part of the document is the top of the document;
      stop the algorithm here.

    7. Otherwise, there is no indicated part of the document.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a site that is using Facebook Connect and recently made some
Ok Im working on a site that has a sidebar and a main content
I'm working on a site that is using Facebook authentication and friends, but I'm
I have a site that i am using session variables. up until last Wednesday
We are using jQuery 1.5.1 on the site that I'm working on. I recently
i developed an asp.net site using forms based authentication, that site is working when
I've working on a site that was written using Prototype but we're phasing it
I'm working on a site that uses basic authentication. Using Chrome I've logged in
I'm currently working on a site that makes several calls to big name online
I am working on a site that is using the unfortunate practice of wrapping

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.