[jQuery] Re: using a var in both functions of a hover(over, out)

2007-10-10 Thread Joel Birch
On 10/10/07, Olivier Percebois-Garve [EMAIL PROTECTED] wrote: I want to store something in the first function (over) and use it in the second (out). -Olivier Hi Olivier, I think this would work: jQuery.fn.simpleTooltip = function(o){ var sharedVar; $(this).hover( function(){

[jQuery] Re: using a var in both functions of a hover(over, out)

2007-10-10 Thread Suni
This is correct. In javascript the inner functions have access to the variables of the outer function. They even retain that direct access after the outer function has returned, allowing you to create private variables and methods (through closure).