I am trying to achieve a scrolling effect on my webpage by clicking a button that will target a specific div
with the class "second". Currently, I have implemented this functionality using jQuery but I am curious about how to accomplish the same task using vanilla JavaScript.
document.querySelector('button').addEventListener('click', function() {
window.scrollTo({
top: document.querySelector(".second").offsetTop,
behavior: 'smooth'
});
});