How can I call a method from my current class using keypress ?
Hello,
I have the following code in one of my pages. My problem is caused, because the method "processEvent" is never called, but I have no idea why. I guess it is broken, because I don't relay the "this" object correctly.
Any ideas?
- <script type="text/javascript">
var MyClass = function()
{
this.init = function()
{
$("mydiv").keypress( this.processEvent );
}
////////////////////////////////////////////
this.processEvent = function( event )
{
// Something here...
}
////////////////////////////////////////////
}
- var mc = new MyClass();
- mc.init();
</script>
Thanks in advance.