I would like to select all cells of the first column of a table. Can anyone please tell me the coe.
Tried this..
$('.sortable tr:nth-child(1)'); // getting entire row.
I would like to select all cells of the first column of a table. Can anyone please tell me the coe.
Tried this..
$('.sortable tr:nth-child(1)'); // getting entire row.
$('.sortable tr td:first').each(function(){
alert($(this).text());
});
This (fairly verbose) selector should work:
$(".sortable tr > :nth-child(1)")
If you want another column, simply change the index to nth-child
to something other than 1
.
This will select both td
(data) and th
(header) cells, btw.