> function Editor() { // class Editor
> var self = this;
> $(document).ready(function() { self.doSomething(); });
> }
The simplest way, that I've found, to "avoid this issue" is to simply
pass in the context as an argument to the function - so doing:
function Editor(self) {
$(function(){
self.doSomething();
});
}
Of course, if you still want to use 'this', there's another really
easy way to do it:
function Editor() {
$( self.doSomething );
}
In this case you're passing in a function to the document ready (since
doSomething is just a function, no need to wrap it again). Although,
this depends a lot on what code you're trying to execute.
--John
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/