At first sorry for my English I have stupid problem: There is document like that: <ul class="class1"> <li class="selected">Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul> ..... <ul class="class1"> <li class="selected">Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul> ..... <ul class="class1"> <li class="selected">Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul>
------------------------- and css like that: ul.class1 li { dispaly: none; } .selected { display: list-item; } And I have function: setType = function(n) { $('ul.class1').each(function() { $(this).children("li").each(function(i) { if( i != n ) $(this).removeClass("selected"); else $(this).addClass("selected"); }); }); } I work with lists so: setType(2) Iwould like to add some effects to this action ( fadeOut and fadeIn ) First part of code I can write: $('ul.class1 li.selected').fadeOut("slow"); And it works fine. But now I have to show list items and add class "selected". I can't understand, how I can select item number "i" in each list to make fadeIn and addClass to it ?