jQuery Latest Version Tutorials | Lecture 4 | Jquery Callback-Chaining|Tutorialspoint JavaScript

Publié le: 04 novembre 2024
sur la chaîne: Laugh and Learn
46
2

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.
Typical syntax: $(selector).hide(speed,callback);
jQuery - Chaining
With jQuery, you can chain together actions/methods.
Chaining allows us to run multiple jQuery methods (on the same element) within a single statement.
jQuery Method Chaining
Until now we have been writing jQuery statements one at a time (one after the other).
However, there is a technique called chaining, that allows us to run multiple jQuery commands, one after the other, on the same element(s).
Tip: This way, browsers do not have to find the same element(s) more than once.
To chain an action, you simply append the action to the previous action.
jQuery Callback Functions
A callback function is executed after the current effect is 100% finished.


Sur cette page du site, vous pouvez voir la vidéo en ligne jQuery Latest Version Tutorials | Lecture 4 | Jquery Callback-Chaining|Tutorialspoint JavaScript durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Laugh and Learn 04 novembre 2024, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 46 fois et il a aimé 2 téléspectateurs. Bon visionnage!