Jquery set html with effect

I have a div that already displays some html. I would like to replace the contents of a div with some other html. However, I would like the transition to have an effect, such as fading.

I tried this:

$('#mydiv').html('Some new text').fadeIn(1500); 

but the transition occurs immediately, without the fading effect. It can be done?

thanks

+4
source share
1 answer

try it

 $('#mydiv').hide().html('Some new text').fadeIn(1500); 
+16
source

All Articles