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() {
console.log("occured!")
var anchorlink = document.getElementById("video");
anchorlink.scrollIntoView();
}
<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!
