jQuery/javascript events - prototype event handler
- by Brian M. Hunt
The following code doesn't work as I intuitively expect it to:
function MyObject(input) {
input.change(this._foo);
this.X = undefined;
}
MyObject.prototype._foo = function() {
alert("This code is never called");
// but if it did
this.X = true;
}
var test_input = $("input#xyz"); // a random, existing input
var m =…