# Anchor Link Scroll Effect

**URL:** <https://community.hubspot.com/t/anchor-link-scroll-effect/471>\
**Category:** CMS Development\
**Created:** [November 25, 2016, 2:56pm UTC](https://community.hubspot.com/t/anchor-link-scroll-effect/471 "2016-11-25T14:56:48Z")\
**Posts on this page:** 1\
**Showing post:** 32

<div class="post-metadata">

**Author:** ![Ty](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ty/32/5413_2.png) [@Ty](https://community.hubspot.com/u/Ty)\
**Post date:** [November 21, 2017, 5:10pm UTC](https://community.hubspot.com/t/anchor-link-scroll-effect/471/32 "2017-11-21T17:10:06Z")

</div>

Hi @phaslehurst,

Looking at your code, it seems you’re calling your href as if it was an id.

In the line

`$(document).on('click', '#top', function(event){ }`

This is saying “On click of element with the id of “top”, perform this function”. But your button is just an \<a\> with the href of #top.

```auto
<p><strong><a href="#top">FIND OUT MORE - GET IN TOUCH NOW</a></strong></p>

```

To fix this, you can either add a unique class or id to your \<a\> then call your function with that element’s id or class. So the easiest fix would be changing your text link to this:

```auto
<a id="top" href="#top">FIND OUT MORE - GET IN TOUCH NOW</a>

```

Let me know how this works out for you!

-- Ty

---

_[View the full topic](https://community.hubspot.com/t/anchor-link-scroll-effect/471)._
