I want to show the div and delete it after a few seconds. It is just that simple. So in my html I have: <div id="msg"></div>
And I have this function:
function showWarning(text) { $('<div>'+text+'</div>').appendTo('#msg').hide().fadeIn('fast').delay(1000).queue(function() { $(this).fadeOut(); }); }
I canβt find a way to make this work. fadeOut() is called, but nothing happens on the screen. If I change fadeOut() to hide() , it works fine. However ... If I try hide(500) then this will not work.
I suppose this is something trivial - a beginner's mistake, but I can't find it.
thanks
source share