I have a table with images in one column. When I click the image, would like to get the text value of the first column in that row.
I can get the whole row with this:
var a = $(this).parents('tr').text();
However, I cannot isolate the first cell of the row.
I've tried
var a = $(this).parents('tr td:first').text();
But that just returns the first cell of the entire table.
Can anyone help me out?
Thanks.
var Something = $(this). closest('tr'). find('td:eq(1)'). text();
How about?
var a = $('td:first', $(this).parents('tr')).text();
Here's another option:
var a = $(this).closest('tr').find('td:first').text();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With