Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Broken anchor links (#section missing): how to find and fix

PRF-148Low impactCould addBy FunnelGuardPublished Updated
On this page

What this issue is

An anchor link (also called a jump link or in-page link) ends with a # and a name, for example #contact. When you click it, the browser looks for an element with id="contact" and scrolls to it.

The link is broken when no element has that ID. The browser does not show an error. The page just stays where it is, or the visitor lands at the top. Typical causes are a renamed section, a typo, different capitalisation (IDs are case-sensitive), a section deleted in a redesign, or a block that loads later with JavaScript.

A working anchor link and its targethtml
<a href="#plans">See plans</a>

<section id="plans">
  <h2>Plans</h2>
</section>

Why it costs you leads or sales

Anchor links are often your call to action. A hero button that says "Get a quote" may jump to a form lower down. If the jump fails, the visitor sees nothing happen and may think the page is broken. Some will scroll to find the form, others leave.

The business impact is usually low, because most visitors can still scroll. It grows when the broken link is the main button on a landing page, or when an ad or email links straight to a section such as /offer#signup.

Where a broken anchor stops the journey
  1. Landing pageVisitor reads the hero
  2. Click "Get a quote"href="#quote-form"
  3. Jump to formNo element has id="quote-form"
  4. Form submittedVisitor never reaches it

The visitor clicks a button meant to jump to the form. The target ID is missing, so the form is never reached.

Visitors who reach the form after clicking the buttonExample numbers
Visitors who reach the form after clicking the button (example)Working anchor: 60 %; Broken anchor: 35 %023466035Working anchorBroken anchor%

Example: illustrative numbers only. A working jump link keeps more visitors moving toward the form than a dead one.

How to check if your site has it

Check anchor links by hand
  1. Click every in-page link

    On key pages (landing pages, pricing, service pages), click each button and menu item that links to a #section. It should scroll to the right place.

  2. Read the URL after the click

    Check the address bar shows the #name you expect. If the page did not move, the target is probably missing.

  3. Search the page for the ID

    Open DevTools (F12), go to Elements, press Ctrl+F (Cmd+F on Mac) and search for id="name". No match means the link is broken.

  4. Test in the console

    Run the snippet below on the page to list every in-page link with no matching ID.

  5. Test links from other pages and ads

    Open URLs like /page#section in a new tab. Also check emails and ads that use them.

List broken in-page anchors (paste in the browser console)javascript
[...document.querySelectorAll('a[href^="#"]')]
  .map(a => a.getAttribute('href').slice(1))
  .filter(id => id && !document.getElementById(id) && !document.getElementsByName(id).length)
  .forEach(id => console.log('Missing target:', '#' + id));

How to fix it

The fix is always one of two things: add the missing ID to the right element, or change the link so it matches an ID that exists. Pick whichever is less risky. IDs should be lowercase, contain no spaces, and be unique on the page.

Fix the anchor on your platform
  1. Add the ID in the block editor

    Select the target block (for example a Group or Heading), open Settings, expand Advanced and type the name in HTML anchor, without the #.

  2. Match the link

    In the button or link, set the URL to #name exactly as typed. In page builders such as Elementor, the equivalent field is CSS ID under Advanced.

Stop a sticky header hiding the targetcss
[id] {
  scroll-margin-top: 80px; /* set to your header height */
}

How to confirm it's fixed

Confirmation checks
  • Clicking the link scrolls to the intended section.
  • The address bar shows the expected #name.
  • Opening the full URL with #name in a new tab lands on the section.
  • The console snippet reports no missing targets.
  • It works on mobile and with the sticky header visible.
  • It works after a hard refresh with the cache cleared.

How to prevent it happening again

Habits that stop anchors breaking
  • Click every in-page link after redesigns, theme updates or section reordering.
  • Keep a short list of anchors used in ads, emails and menus.
  • Use lowercase IDs with hyphens and no spaces.
  • Avoid duplicate IDs on one page.
  • Run a crawler or link checker that reports missing fragment targets.
  • Check sections that load late with JavaScript, because the ID may not exist when the page first loads.

How FunnelGuard handles this

FunnelGuard does not check for broken anchor links today. It is a possible future check.

What FunnelGuard does do is run your real customer journeys with a robot visitor on a schedule, such as lead forms, checkouts and booking or chat buttons. If a step fails, for example a button that cannot be clicked or a form that cannot be reached, the failure is re-checked from a second region and you get one alert with a screenshot and a likely cause. That can surface a journey broken by a dead jump link, but it is not a dedicated anchor check.

To watch for broken anchors yourself, run the console snippet above after each site change, or use a crawler or accessibility tool that reports missing fragment targets. A free read-only FunnelGuard website audit is also available, and the Free plan covers 1 site and 2 journeys with daily checks, no card needed.

Questions people ask

Why is my anchor link not scrolling to the section?

Most often the element it points to has no matching ID. The link says #plans but the section has id="pricing", or the case differs. Inspect the page, find the section and make the ID and link match exactly.

Are anchor link IDs case-sensitive?

Yes. In HTML, #Contact and #contact are different targets. Use lowercase IDs with hyphens everywhere to avoid mismatches.

How do I find broken anchor links on my website?

Click each in-page link on key pages, or paste a short script in the browser console that lists href values starting with # that have no element with that ID. A site crawler that checks fragments can do this across many pages.

Why does my anchor link go to the top of the page?

The browser could not find the target ID, so it stays at the top. It can also happen when the target is added by JavaScript after the page loads. Make sure the element exists in the page and has the right ID.

Do broken anchor links hurt SEO?

They are not a ranking problem on their own, since search engines generally ignore the part after the #. The harm is user experience: a button that does nothing can lose clicks and leads.

Why does my anchor link scroll but hide the heading under the header?

A fixed or sticky header covers the top of the target. Add scroll-margin-top to the target elements in CSS, set to your header height, so the browser leaves space.

Does FunnelGuard detect broken anchor links?

No. FunnelGuard does not check anchor links yet; it is a possible future check. It does run your real journeys on a schedule, so a journey that cannot complete will be reported, but not as an anchor issue.

Does FunnelGuard catch this?

Could add

Not checked yet: could be added to FunnelGuard.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.