AJAX
Basics
Data
DOM
Effects
Events
Forms
jQuery UI
Plug Ins
Traversing
A callback function is executed after the current effect/function is 100% finished. JavaScript statements are executed line by line. However, with effects, the next line of code can be run even though the effect is not finished/delayed. This can create errors. To prevent this, you can create a callback function.
A callback function is executed after a current effect (or some other function if supported) is finished. This is really more of a js concept and not so much as jQuery feature.
$({jquery selector}).{function name}(speed, {callback function});
$("#btnHide").click(function ()
{
//correct
$("#demo1").hide(3000, function () { alert("Demo1 is now hidden"); });
//NOT correct
$("#demo1").hide(3000, alert("Demo1 is now hidden"));
});