I have a table which is dynamically built, what i want is that when i click, a function executes that give me the id of last column of every row, I used the following code where i alert every columns’s id but it is not working . can any one help me ???? this is the loop which is used in the function
$('table[id="' + tableID + '"]').find('tr').each(function () {
alert($('td:last-child').attr("id"));
});
what i get in the alert is the id of the first row’s last column in every iteration of the loop
An alternative might be:
The important thing is the $(this) inside the each iterator. It refers to current element on the iteration, for instance each row element (TR) on the table. From that element you can do whatever you need, for this case just find the last cell ID.