Answer the question
In order to leave comments, you need to log in
How to make it so that when you click on the button, it follows the link with a delay?
Hello, how in javascript to make it so that when you click on the button, 3 seconds pass and then follow the link?
That is, the transition to the link with a delay.
Thanks in advance, I will be very grateful
Answer the question
In order to leave comments, you need to log in
button.addEventListener('click', function(evt){
evt.preventDefault();
setTimeout(function(){
location.href = '//google.com';
}, 3000) // 3000 ms = 3s
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question