jQuery .delay() not delaying the .html() function jQuery .delay() not delaying the .html() function jquery jquery

jQuery .delay() not delaying the .html() function


delay will work for your case when used with the queue like this:

$("#products").fadeOut(500)    .delay(600)    .queue(function(n) {        $(this).html("hahahhaha");        n();    }).fadeIn(500);​

Try it here: http://jsfiddle.net/n7j8Y/


Maybe the "queue" way it's ok,But this javascript solution works better for me:

    setTimeout (function(){      $("#products").html('Product Added!');    },1000);


you could change it to make the change when the fadeOut is completed using the fcallback function parameter.

so it becomes:

$("#products").fadeOut(500, function() {    $(this).html($("#productPage" + pageNum).html());    $(this).fadeIn(500);});