Mul*_*ner 4 javascript jquery css-selectors jquery-selectors
如何选择普通html表的第n列中的所有单元格.我试过这个,但它不起作用:
$('table#foo tbody td:nth-child(3)').each(function (index) {
$(this).addClass('hover');
});
Run Code Online (Sandbox Code Playgroud)
更新:继承人的工作代码:http://jsfiddle.net/Claudius/D5KMq/
fea*_*net 10
没有必要使用each它.
$('table#foo tbody td:nth-child(3)').addClass('hover');
Run Code Online (Sandbox Code Playgroud)
除此之外,您的代码没有任何问题.问题必须在其他地方.