You can use callbacks, like this:
$("#container").fadeOut(function() {
$(this).text("World").fadeIn();
});
You can give it a try here, or because of how the queue works in this particular case, like this:
$("#container").fadeOut(function() {
$(this).text("World")
}).fadeIn();
This executes the .text()
call when the .fadeOut()
is complete, just before fading in again.