trowley Posted January 24, 2011 Report Share Posted January 24, 2011 Hey: Is there a way to set a var within the $(document).ready function and retrieve the value in a function outside of the that? Thanks! Quote Link to comment Share on other sites More sharing options...
BeeDev Posted January 25, 2011 Report Share Posted January 25, 2011 yes declare the var outside $(document).ready and that should do it: var myVar; $(document).ready(function(){ myVar = 1 echoMyVar(); }); function echoMyVar(){ alert(myVar); }; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.