Wait for animation to complete before continuing in jQuery
<p>Is there anyway to wait for a jQuery animation to finish before proceeding with another command?</p>

<p>For example, I want to fade out/slide up an element, change some items within the element and then fade them back in/slide back down.</p>

<p>If I put the statements one after another, you can see the items change before the animation completes.</p>

<pre><code>$('#item').fadeOut();
$('#item').html('Changed item');
$('#item').fadeIn();
</code></pre>

<p>Thanks.</p>
