hi,
i'm trying to capture keystrokes inside my prototype function, here's my code:
function txtBox(input) // pass textbox
{
this.id = "myTextbox";
this.txt = input
}
txtBox.prototype.init = function()
{
this.txt.bind("keyup",this.keyup);
}
txtBox.prototype.keyup= function(event)
{
alert("keycode: event.keyCode);
alert(this.id);
}
var myTxt = new txtBox($(#txt)); // create object
myTxt.init();
capturing works but the problem is that the keyup triggers "outside" my object, which means this.id returns "undefined" although it was defined.
anyone knows how to keep consistency with this?
thx, fuxi