Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery - Timer?

Tags:

jquery

I need to call my function abc(), 5 seconds after the document ready fires.

Is this possible in jQuery?

$(document).ready(function () {

//Wait 5 seconds then call abc();

});

function abc() {}
like image 658
Ian Vink Avatar asked Feb 16 '11 01:02

Ian Vink


People also ask

Is there a timer in JavaScript?

There are two timer functions in JavaScript: setTimeout() and setInterval() . The following section will show you how to create timers to delay code execution as well as how to perform one or more actions repeatedly using these functions in JavaScript.

What is the use of delay () method in jQuery?

jQuery delay() Method The delay() method sets a timer to delay the execution of the next item in the queue.

How do you make a 10 second timer in JavaScript?

To create a simple 10 second countdown with JavaScript, we use the setInterval method. to add a progress element. let timeleft = 10; const downloadTimer = setInterval(() => { if (timeleft <= 0) { clearInterval(downloadTimer); } document.


1 Answers

$(document).ready(function () {

//Wait 5 seconds then call abc();
    setTimeout(abc, 5000);

});

setTimeout()link

like image 147
Reigel Avatar answered Oct 05 '22 03:10

Reigel