I am trying to use a classical inheritence model for a JavaScript app I am writing, and it relies on having this defined to be the current instace of the class that the method is being called on. This works fine.
The problem is that I then try to bind methods of that object in JQuery, and it overwrites this to be a JQuery element, which is problematic.
I know the usual way to do this is to just save a copy of this right before calling out to $.bind, but since I am bindinga method in my class, there is no “right before” I have access to.
I am beggining to give up hope that I will be able to get this style of OOP working with JQuery’s callbacks as being too crazy, but I figured it wouldn’t hurt to ask.
You could use jQuery’s
$.proxy()to changethis.