How do I select all cells in nth column of a normal html table. Ive tried this but its not working:
$('table#foo tbody td:nth-child(3)').each(function (index) {
$(this).addClass('hover');
});
UPDATE: Heres a jsfiddle of the unworking code: http://jsfiddle.net/Claudius/D5KMq/
There is no need to use each
for this.
$('table#foo tbody td:nth-child(3)').addClass('hover');
Other than that, there's nothing wrong with your code. Problem must be somewhere else.
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