I would store the indexes as attributes and add a single click handler to the table :
var tableHtml = '';
for(var i=0; i<5; i++) {
tableHtml += '';
for (var j=0; j<5; j++) {
tableHtml += ' | ';
}
tableHtml += '
';
}
$('table').append(tableHtml).on('click', 'td', function(ev) {
var i = this.getAttribute('data-i'),
j = this.getAttribute('data-j');
});