views:

199

answers:

1

In jQuery how do I use a selector to access all but the first of an element? So in the following code only the second and third element would be accessed. I know I can access them manually but there could be any number of elements so thats not possible. Thanks.

<div class='test'></div>
<div class='test'></div>
<div class='test'></div>
+9  A: 
$("div.test:not(:first)").hide();

or:

$('div.test:gt(0)').hide();

See:

karim79