Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Uday DodiyaRank #239 · 10.3K reputationPosted Oct 27, 2022, 2:09 AM EDT
A callback function is executed after the current effect is 100% finished.
jQuery Callback Functions
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. This can create errors.
To prevent this, you can create a callback function.
A callback function is executed after the current effect is finished.
For More Refer Following
https://www.tutorialspoint.com/jquery/jquery-callback-functions.htm
Typical syntax: $(selector).hide(speed,callback);
Examples
The example below has a callback parameter that is a function that will be executed after the hide effect is completed:
Example with Callback
$("button").click(function(){ $("p").hide("slow", function(){ 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
$("button").click(function(){ $("p").hide(1000); alert("The paragraph is now hidden"); });For More Refer Following
https://www.tutorialspoint.com/jquery/jquery-callback-functions.htm
Vishal YelveRank #178 · 13.6K reputationPosted Oct 27, 2022, 2:52 AM EDT
A Callback() function is executed once the effect is complete. It is always written as the last argument of the method.
Please refer to below links for more details
https://www.tutorialspoint.com/jquery/jquery-callback-functions.htm
https://www.tutorialrepublic.com/jquery-tutorial/jquery-callback.php
https://www.geeksforgeeks.org/jquery-callback-functions/
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Oct 27, 2022, 9:36 AM EDT
Hello Naresh go through below article
https://www.c-sharpcorner.com/UploadFile/rohatash/using-callback-function-in-jquery/
Brahma Prakash ShuklaRank #633 · 3.8K reputationPosted Oct 27, 2022, 5:43 AM EDT
A jQuery Callback Function is a function that will be executed only after the current effect gets completed.
Example-
The jQuery Example $(document).ready(function() { $("div").click(function(){ $(this).hide(1000); alert("I'm hidden now"); }); }); div{ margin:10px;padding:12px; border:2px solid #666; width:60px; cursor:pointer} Click on any of the squares to see the result: Hide Me Hide Me Hide Me