An example
<script>
setTimeout(function() {
alert('You waited 3 seconds!');
}, 3000);
</script>
So, when you open a website with this script and wait 3 seconds (3000 milliseconds), an alert will pop up on the screen.
Sometimes you want to run a function a few seconds after the user has opened your website or similar. In this short guide, I'll show you how to do this.
<script>
setTimeout(function() {
alert('You waited 3 seconds!');
}, 3000);
</script>
So, when you open a website with this script and wait 3 seconds (3000 milliseconds), an alert will pop up on the screen.
No comments yet...