Reputation: 26071
I'm trying to select the all anchor tags in a table that have the class .action except the first one but can't seem to do it using the css filters.
$(".action:not(:first)").css("visibility", "hidden");
Has no effect
I have also tried doing each one explicitly like such
$("tr:contains('Second') .action").css("visibility", "hidden");
but this makes all .action hidden
Solved!
$('.action:not(:first, :nth(2))').css("visibility", "hidden");
Upvotes: 1
Views: 202
Reputation: 816404
You might have to adjust your selector so that only the .action
elements inside the table are selected.
You can use .slice
[docs], but if your selector does not work, this won't either:
$(".action").slice(1).css("visibility", "hidden");
Upvotes: 4