How to redirect to the next page using addEventListner?
Here, when I click the button it has to redirect to another HTML page how to write the code for that.
HTML
<button>submit</button>
JS
let btn = document.querySelector('button')
btn.addEventListener('click', () => {
})
You can try this:
let btn = document.querySelector('button')
btn.addEventListener('click', () => {
window.location.replace('http://www.example.com');
})