How to make the entire row in a table clickable as a link, except the last column?
It is because you are getting all the tr's in the table and then the first anchor that is found will be returned, try changing it like this:
$('#dataTable tr td:not(:last-child)').click(function () {
location.href = $(this).parent().find('td a').attr('href');
});
what it means is it will get the clicked element $(this) as a jquery object, and then go to its parent. (the row element).