2

I am assuming that jquery's method chaining has to do something with callbacks internally.

A callback function is executed after the current effect is finished.

In the following jquery method chaining code, slideUp(2000) has to be completed in order for slideDown(2000) to be executed. Which means it is as same as the callback functions.

with method chaining

 $("#p")slideUp(2000).slideDown(2000);

with callbacks

$(document).ready(function(){
    $("button").click(function(){
        $("p").slideUp(2000, function(){
            $("p").slideDown(2000);
        });
    });
});

I am getting the same effect from both the codes. Does it mean that jquery method chaining is implemented using callbacks internally?

DesirePRG
  • 6,122
  • 15
  • 69
  • 114

0 Answers0