オブジェクト関数 (つまり .each()) 内で jQuery メソッドを使用する場合、"this" 変数は反復されるオブジェクトを参照します。「this」なしでオブジェクトの機能にアクセスするにはどうすればよいですか? ちょっとややこしいので、次のようにします。
test.prototype.init = function(node) {
node.children().each(function() {
//call test.anotherFunction() here
//Would normally call this.anotherFunction(),
// but "this" refers to the current child.
});
}
test.prototype.anotherFunction = function() {
//whatever
}
ヘルプ?