It is duplicate of How to access the correct `this` context inside a callback?, but I was unable to find it here according to my problem description. A lot of people could have the same issue.
I have an object like:
var my_object = new function() {
this.function2 = function() {
$("#button").click(function() {
this.function1()
})
};
this.function1 = function() {
};
}
a = my_object()
If I click the #button this happen
this.function1 is not a function
How to correctly solve this issue? How to prevent jquery from overwriting my "this"?