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
eachfor this.Other than that, there’s nothing wrong with your code. Problem must be somewhere else.