JavaScript statements are executed line by line. But, since jQuery effect takes some time to finish the next line code may execute while the previous effect is still running. To prevent this from happening jQuery provides a callback function for each effect method.
A callback function is a function is executed after the current effect is finished.
The callback function is passed as an argument to the effect methods and they typically appear as the last argument of the method. For example, the basic syntax of the jQuery slideToggle()
effect method with a callback function that will be executed after the hide effect is completed.
The below example has a callback parameter that is a function that will be executed after the slideToggle()
effect is completed :