adspace


How can you delay document.ready until a variable is set?

Answer Posted / Dheerendra Singh

To delay the execution of code until a specific variable has been defined, you can wrap your code within an immediate function call and use a closure. Here's an example:nn```javascriptnvar myVariable;nn$(function() {n // Assuming that myVariable is set elsewhere in your coden if(myVariable) {n // Execute the code after myVariable has been definedn }n});n```

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do you have plans for a new jquery plug-in or something else we should look out for? Where to from here for the imgpreview plugin?

864


How to always reference latest version of jquery?

875


How can jquery library be added to pages?

952


What is the minimum setup needed to start using jquery.

939


How do you install/use jquery in a project. What is the minimum setup needed to start using jquery.

999


How to validate email using jquery?

974