So what is "myObject"?

On 7/27/07 1:38 PM, "Jeffrey Kretz" <[EMAIL PROTECTED]> wrote:

> 
> So far as I know,
> 
> $(this).change(myObject.myFunc);
> 
> will work fine.  But when the myFunc is executed, any reference to "this"
> inside that function will refer to the object that triggered the change,
> rather than its owner, "myObject".
> 
> JK
>          
> 
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of Klaus Hartl
> Sent: Friday, July 27, 2007 9:14 AM
> To: [email protected]
> Subject: [jQuery] Re: named function vs anonymous functions
> 
> 
> Stephan Beal wrote:
>> On Jul 27, 5:48 pm, Christof Donat <[EMAIL PROTECTED]> wrote:
>>>> so what is the proper syntax for calling this named function for that
>>>> change event?
>>> $(this).change(myfunction);
>> 
>> To expand on that a small bit: if you want to call a method of an
>> object then you must create an anonymous function to do it for you:
>> 
>> $(this).change( function(){ myobject.myFunc() } );
> 
> I was of the impression that
> 
> $(this).change(myObject.myFunc);
> 
> would work...
> 
> 
> --Klaus
> 
> 
> 

Reply via email to