Your first attempt is very close, but remember that append() returns #thumbnails , not the element you just added to it. Instead, first create your element and apply hide().fadeIn() before adding it:
$('#thumbnails').append($('<li><img src="/photos/t/'+data.filename+'"/></li>').hide().fadeIn(2000));
It uses the dollar function to build <li> ahead of time. You can also write it on two lines, of course, if that becomes clearer:
var item = $('<li><img src="/photos/t/'+data.filename+'"/></li>').hide().fadeIn(2000); $('#thumbnails').append(item);
Edit: Your second attempt also almost exists, but you need to use children() instead of filter() . The latter removes nodes only from the current request; your newly added item is not in this request, but instead is a child node.
$('#thumbnails').append('<li stle="display:none"><img src="/photos/t/'+data.filename+'"/></li>').children(':last').hide().fadeIn(2000);
Ben Blank Jun 11 '09 at 0:09 2009-06-11 00:09
source share