[jQuery] Re: Scope Of Variables Inside Functions

2008-09-30 Thread ricardobeat
You'll find that you'll likely never have to do a for loop like that using jQuery. And in your sample the function is being attached to the mouseover event 5 times. If you need access to a variable outside the function scope make it a property of a global object, like: var QuickScriptz; // store

[jQuery] Re: Scope Of Variables Inside Functions

2008-09-29 Thread Karl Rudd
This is really to do with how JavaScript handles scope, not something jQuery has control over. In short: If you DON'T use the "var" keyword in front of variable you assign values to, that variable becomes a "global" variable. If you DO use the "var" keyword, the variable becomes "local" to the