Wait for jQuery show() to finish before continuing function?

David picture David · Jun 23, 2009 · Viewed 12.3k times · Source

I can't make my div visible with the jquery show() until my function is over! It actually works in IE/FF but not in Chrome. How can I make sure my element is visible before continuing with my function?

Here's my code:

function doOperation(){
    $("#progressbar_area").show();
    (...)
}

Answer

kgiannakakis picture kgiannakakis · Jun 23, 2009

Add a callback to show:

$("#progressbar_area").show(speed, function() {});

The callback function will be called when the animation is complete.