I have created a button on a landing page, I would like users to be redirected to another section (in my case the contact section) on the same page when they click this button. I have tried doing this but it's not working
document.querySelector('#btn').
addEventListener('click',()=>{
document.querySelector('#contact').
style.scrollBehavior = 'smooth'
})
<button id="btn">Discover Now</button>
<section id = "contact" class="contact"></section>
I have also tried this
<button><a href="#contact">Discover Now</a></button>
but did not work, where am I doing it wrong?