How to exclude second column from selector

My question is, how can I change the selector so that it throws the second column exception from the hover event

I tried some other options like nth-child but no luck so far. Could there be something wrong with the syntax?

$('.row_class td:not(:eq(1))').hover(

      

thanks richard

0


a source to share


2 answers


Try the following:

$('tr.row_class td:not(:nth-child(2))').hover(function() {
    $(this).css('color','red');
}, function() {
    $(this).css('color','black');
});

      



It works for me .

By the way, class selectors are slow. If you know what .row_class

will only apply to elements <tr>

, you should make a selector tr.row_class

like in my example. Just free advice. :)

+1


a source


$ ('. row_class td: first-child'). hover (



-2


a source







All Articles