[jQuery] Wait for Fade event to complete before initiating next action

[jQuery] Wait for Fade event to complete before initiating next action


Hi,
I've been trying to change the content of an element using html(),
however I want to fade the element out before I change the contents.
sample code:
    $(document).ready(function(){
        $("#menu li").click(function(){
            $(this).fadeTo(1000,0).html("changed").fadeTo(1000,1);
        });
    });
I have tried to implement a waiting period in between the fadeTo() and
the html(), using the pause plugin aswell as using
the .animate({opacity: 1.0}, 3000) method, however the contents of the
<li> always changes before the fade is completed.
Does anybody know how I could let the contents of the <li> fadeout,
then change it using html(), and then fading the new content in again?
Kind regards,
Dennis Bamber