我的问题是如何更改选择器,以便将第二列排除在悬停事件之外
我确实尝试了其他一些变体,例如 nth-child,但还没有运气。语法可能有问题吗?
$('.row_class td:not(:eq(1))').hover(
谢谢,理查德
尝试这个:
$('tr.row_class td:not(:nth-child(2))').hover(function() {
$(this).css('color','red');
}, function() {
$(this).css('color','black');
});
顺便说一句,类选择器很慢。如果你知道.row_class
只会应用于<tr>
元素,你应该让选择器tr.row_class
像我的例子一样。只是一个免费的小费。:)
$('.row_class td:first-child').hover(