following code waits till dom ready
jQuery(document).ready(function(){
what do i have to write to simple let the execution of the jquery function wait for 2 seconds after the document is ready?
i need this to narrow down a conflict between multiple instances of a plugin.
THX
Approach 1: Using the holdReady() method in the jQuery library and the setTimeout() method. First we set the parameter in the holdReady() method to true to hold the execution of the document. ready() method. Then, a timeout function with an appropriate delay time can be added using the setTimeout() method.
Yes, with jQuery.
The standard way of creating a delay in JavaScript is to use its setTimeout method. For example: console. log("Hello"); setTimeout(() => { console.
Wrap your existing function with a call to setTimeout
, ie, replace your current:
jQuery(document).ready(function() { .... });
with
jQuery(document).ready(function() { setTimeout(function() { .... }, 2000); });
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