Other option can be storing data within the elements.
for(var i = 0; i < 5; i++)
{
var tr = $('
');
for (var j = 0; j < 5; j++)
{
var td = $(' | ');
this.data("position",{row:i, column:j});
td.click(function()
{
var position = this.data("position");
alert(position.row + ' ' + position.column); // here I want to access to CURRENT i, j variables
})
td.appendTo(tr);
}
}