Hey! So I have been trying to use the scrollIntoView() in my HTML page. I have an anchor tag in which when clicked a function is executed. And in a separate js file which I have linked in my HTML, it executes element.scrollIntoView() after using document.getElementById(). Here are my code snippets:

function scrollTo() {
    var anchorlink = document.getElementById("video");
<li class="nav-link"><a onclick="scrollTo()">Home</a></li>
<script src="app.js"></script>

Did I type something wrong or am I making a dumb error?. Thanks for your time!

I’d say it’s because scrollTo already exists in browser. Chose a different name for your function.

Yeah, that fixed my code. But I also was able to fix it by used <a href="javascript:scrollTo()>Home</a>. Almost the same solution as yours, to let the browser know not to use the in-built function.

Thanks for your help! :slight_smile: