You can also do this without jQuery using the rowIndex property of the table row element: https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableRowElement/rowIndex
If you have a reference to the image, you can get to the table row using the parentNode property