I have a class:
function RustEditor() {
this.init = function() {
var saveButton = this.container.find("button.saveButton");
saveButton.click(function(){this.save();});
};
...
When I click the button, it complains that this.save is not a function. This is due to the fact that "this" here does not refer to an instance of RustEditor, but to a button. Which variable can I use inside this callback closure to point to a RustEditor instance? I could use rust.editor (it's a name in the global scope), but this smelly code.
source
share