[jQuery] each method
[jQuery] each method
Hi folks,
I have an each method with a function, inside which I want to access
parent's object methods. Here is an example:
MyObj.prototype.f1 = function() {
$("p").each(
function(i) {
this.f2(i); // here is the problem
}
);
};
MyObj.prototype.f2 = function() {
alert(i);
};
I used to use this.f2() to call f2 from f1() but inside each function,
this refers to the currently selected element.
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/