I want to delay the execution of jQuery script for specific time.
For example, I have a user define function ABC()
and i want to call this function after a few seconds.
my example code is below
<script type="text/javascript">
var i = $('#test').val();
//here i want to delay the script for a few second
var value = ABC();
</script>
How can I achieve this?
Use setTimeout
:
var value = null; //set a default value
setTimeout( function(){
value = ABC();
}, 3000); //3 seconds
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With