When I press a button to open a pop-up window, we also go to the top of the web page at the same time. How can I change the code so that when we click the button we won't go to the top of the page?
const modal = document.getElementById("modal")
const overlay = document.getElementById("overlay")
const openBtn = document.getElementById("openBtn")
const closeBtn = document.getElementById("closeBtn")
openBtn.addEventListener("click", function() {
modal.style.display = "block"
overlay.style.display = "block"
})
closeBtn.addEventListener("click", function() {
modal.style.display = "none"
overlay.style.display = "none"
})