I tried your code wrapped in

$('document').ready(function() {

...

});

and it worked fine...

Rick

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Alexander
Sent: Saturday, January 16, 2010 5:42 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Selecting instances separately

Hello everyone,
I've spent 2 hours with this already and I think I must be dumb or blind
since I can't find any hint online.

I've got a couple of galleries as a <ul> in one page <ul class="gallery"
id="galleryid1"> <li><img .....></li> <li><img .....></li> ...
...
..
</ul>

<ul class="gallery" id="galleryid2">
<li><img .....></li>
<li><img .....></li>
...
...
..
</ul>

etc.etc.

For EACH of the galleries - <ul>s SEPARATELY I need to show only 3 <li>s and
hide the rest <li>.

I tried
$(".gallery li:gt(2)").hide();
The result is that only first 3 <li>s are shown and only in first gallery.
The rest is hidden.
I am looking for something like
$(".gallery:each li:gt(2)").hide();

What am I missing ? :)

thanks for ideas.
Alexander





Reply via email to