jQuery Callback Functions
To prevent this, you can create a callback function.
A callback function is executed after the current effect is finished.
Typical syntax: $(selector).hide(speed,callback);
The example below has a callback parameter that is a function that will be executed after the hide effect is completed:
Example with Callback
Â Â Â alert("The paragraph is now hidden");
The example below has no callback parameter, and the alert box will be displayed before the hide effect is completed:
Example without Callback
Â alert("The paragraph is now hidden");