Re: [jQuery] How to bind an event to a function of a class?

2006-08-15 Thread Christian Bach
Hi,

Is this what you mean?

var test = new TestClass();

function TestClass() {

function callback() {
alert('fired!');
}

function doSomething() {

$(document).keypress(callback);
}

//
doSomething();
};



Webunity | Gilles van den Hoven wrote:
> Hi Guys,
> 
> How can i bind/unbind an event to a specific function of a class?
> 
> e.g.
> 
> class {
> somecallback() {
> },
> somefunc() {
> $(document).keypress(this.somecallback);
> },
> otherfunc() {
> $(document).unkeypress(this.somecallback);
> }
> }
> 
> Is this possible?
> 
> Thanx,
> 
> Gilles
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] How to bind an event to a function of a class?

2006-08-15 Thread Webunity | Gilles van den Hoven
Hi Guys,

How can i bind/unbind an event to a specific function of a class?

e.g.

class {
somecallback() {
},
somefunc() {
$(document).keypress(this.somecallback);
},
otherfunc() {
$(document).unkeypress(this.somecallback);
}
}

Is this possible?

Thanx,

Gilles

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/