I'm breaking my head here. I have this Javascript code:
var myPath = {};
for (var i = 0; i < myData.length; i++) {
myPath[myData[i].CodigoEvento].row = {
elem: $("<tr>").appendTo($("#TablaMoviles tbody")).hover(function () {
console.log(i);
}, function () {
console.log(i);
})
}
}
It is suposed to iterarte a data array (myData) and for each item, create a row in a table using JQuery. That works perfect. The problem is when I create the hover event and try to print the index of the row pointed by the mouse(i). Instead of give my row number, it always show the last index of the array.
What am I missing here?
thanks