#11 jQuery Callback Function | jQuery Chaining

Published: 01 January 1970
on channel: Stack Developers
236
8

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

We have seen the callback function in syntax of most of the jQuery methods we have done earlier like animate, slide, fade etc. but now we are going to actually use it practically.

Syntax :-
$(selector).hide(speed,callback);

Example :-
The example in video has a callback function that will be executed after the animate effect is completed.

Example without Callback :-
The example in video has no callback function, and the alert box will be displayed before the animate effect is completed.

jQuery Chaining :-
jQuery Chaining means Chain together or group together multiple jQuery methods within a single statement.

This way, browsers do not have to find the same element(s) more than once.

Example :-
$(document).ready(function(){
$("button").click(function(){
$("h1").animate({left: '250px'}).css("color", "green");
});
});

Join this channel to get access to perks:
   / @stackdevelopers  


On this page of the site you can watch the video online #11 jQuery Callback Function | jQuery Chaining with a duration of hours minute second in good quality, which was uploaded by the user Stack Developers 01 January 1970, share the link with friends and acquaintances, this video has already been watched 236 times on youtube and it was liked by 8 viewers. Enjoy your viewing!