I have the index 2 – i.e. 3rd column, (0 – 1st column, 1 – 2nd column and 2 – 3rd column), with the selector below I am getting only 1 td from the correct column, however I want all the tds in the index 2, how can I achieve that?
$($(selector).find("td").eq(currentCol)).each(function(i) {
Console.log("Left-", currentCol,$(this).width() - diff);
$(this).css("width", ($(this).width() + diff) + "px");
});
Html:
<table style="width: 170mm; text-align: left;" class="te-tablerenderer"><tbody style="text-align: left;"><tr style="text-align: left;" class=""><td style="width: 64px;"><br></td> <td style=""> <b>City:</b> </td><td style=""> <b>City:</b> </td><td style=""> <b>City:</b> </td> </tr><tr style="text-align: left;" class=""><td style="width: 64px;"><br></td> <td style=""> <b>City:</b> </td><td style=""> <b>City:</b> </td><td style=""> <b>City:</b> </td> </tr><tr style="text-align: left;" class=""><td style="width: 64px;"><br></td> <td style=""> <b>City:</b> </td><td style=""> <b>City:</b> </td><td style=""> <b>City:</b> </td> </tr></tbody> </table>
You could loop through each row and grab the td of the col position/index:
Where 2 is the col position/index.
Note: From reading the documentation, the use of the .eq function will only ever return one result, hence why your existing code will only ever affect one element.