Thursday, February 2, 2012

Javascript - closures

for (var i=0; i <= MAX_CHILD_INDEX; i++) {
 (function(i) {
  $('#removeChildPassiveIncomeButton_' + i).click(function() {
   onclickRemoveChildPassiveIncomeButton(i);
  });
 })(i);
}