Hello Readers,
In jQuery, It is a function which is passed as an argument to another function and it is executed when/after it's parent function has been completed.
Callbacks are some special jQuery function because it patiently wait to execute until it's parent function finishes. Meanwhile, the browser can execute some other jQuery functions or do all sorts of the other work.
Typical syntax: $(selector).hide(speed,callback);
The following example has a callback parameter which is a function that will be executed when the hide effect is complete:
$("button.click").click(function(){
$("p").hide("slow", function(){
alert("The paragraph is now hidden!");
});
});
The above example hide is a method where function is a callback function.
Thanks
0 Comment(s)