Hi Dennis,
Yes, use the callback function. $(document).ready(function(){ $("#menu li").click(function(){ $(this).fadeTo(1000, 0, function() { $(this).html("changed").fadeTo(1000,1); }); }); }); --Karl _________________ Karl Swedberg www.englishrules.com www.learningjquery.com On Apr 14, 2008, at 7:13 AM, Iminay wrote:
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