Skip to content Skip to sidebar Skip to footer

Jquery: Hide Children, Show Nth Child?

This is really weird and should be simple. I have an array of images within a tags within a div, eg:

Solution 1:

images != #images plus you need to select the actual images not the container:

$("#images img:nth-child(" + i + ")").show();

But I would just use eq, not sure if the above will work given that the images are inside a tag:

$("#images img").eq(i).show();

In any case, you don't need that while loop, just use jQuery's each to loop the collection.

Also note that delay only works if there's an animation queue and this not your case.

Post a Comment for "Jquery: Hide Children, Show Nth Child?"