To set a timeout or delay in jQuery, you can use the setTimeout()
method.
Here is an example of how to set a delay of 1 second (1000 milliseconds) before executing a function:
setTimeout(function(){
// code to be executed after 1 second
}, 1000);
In this example, the anonymous function will be executed after 1 second.
You can also pass additional arguments to the setTimeout()
method if needed. Here's an example:
setTimeout(function(arg1, arg2){
// code to be executed after 1 second with arguments arg1 and arg2
}, 1000, arg1Value, arg2Value);
In this case, the anonymous function will be executed after 1 second with the provided arguments arg1Value
and arg2Value
.