【发布时间】:2012-08-31 19:34:14
【问题描述】:
从 $.each() 中访问 this.rules 变量的最佳方法是什么?任何有关原因/方式的解释也会有所帮助!
app.Style = function(node) {
this.style = node;
this.rules = [];
var ruleHolder = node.find('Rule');
$.each(ruleHolder, function(index, value) {
var myRule = new app.Rule($(ruleHolder[index]));
this.rules.push(myRule);
});
console.log(this.rules)
}
【问题讨论】: