To prevent this from occurring JQuery provides a callback function for each effects.
A Callback() function is executed once the effect is complete. It is always written at as the last argument of the method.
Examples-1: We define a div, and add a button below the div. Now we make the button allow the div to hide using a simple JQuery Code.
Alert after click:
Example-2: Now we add the callback function inside the slideToggle()
Check out the code and the difference:
Alert after click:
- How to perform jQuery Callback after submitting the form ?
- How to call functions after previous function is completed in jQuery ?
- How to Display/Hide functions using aria-hidden attribute in jQuery ?
- Implementing callback in PHP
- What is callback hell in Node.js ?
- Node.js | Callback Concept
- Difference between regular functions and arrow functions
- How to convert an existing callback to a promise in Node.js ?
- Inverse functions and composition of functions
- How to operate callback-based fs.readdir() method with promises in Node.js ?
- How to operate callback-based fs.mkdir() method with promises in Node.js ?
- How to operate callback-based fs.rename() method with promises in Node.js ?
- How to operate callback-based fs.opendir() method with promises in Node.js ?
- How to operate callback-based fs.lstat() method with promises in Node.js ?
- How to operate callback-based fs.truncate() method with promises in Node.js ?
- How to operate callback-based fs.readFile() method with promises in Node.js ?
- How to operate callback based fs.appendFile() method with promises in Node.js ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.