Jquery replaceWith - fadeout / Fadein Jquery replaceWith - fadeout / Fadein ajax ajax

Jquery replaceWith - fadeout / Fadein


$('div').fadeOut(1000,function(){ $(this).text('no no').fadeIn(1000); });

use the callback functionality fadeOut provides


$('div').fadeTo(1000, 0, function(){ $(this).html('<span>no no</span>').fadeTo(1000, 1); });

I'd take DoXicK's suggestion just a little further with FadeTo. I also incorporated the .html function you were discussing. I prefer fadeTo because it gives you a little flexibility and avoids some undesired behavior if the stop() function ends up in play. Not to mention you can fade to whatever percentage you like.