Possible Duplicate:
Making my ajax updated div fade in
I want the content from AJAX call to fadeIn on my page, but when I use this code $('#sub_container').html(content).fadeIn(); it doesn’t work, even if I set the animation speed to super slow (slow(5000))
$('.create').click(function(){
loadingimg();
document.title = 'Create Message';
$.ajax({
url: 'create.php',
dataType: 'html',
success: function(content){
$('#sub_container').html(content);
// $('#sub_container').html(content).fadeIn(); <- Fails
}
});
});
The
.fadeIn()function essentially makes the element visible, so will appear to do nothing if the element is already visible. You can ensure that’s not the case by hiding the element: