jQuery - Chaining
With jQuery, you can chain together activities/methods.
Chaining enables us to run numerous jQuery strategies (on the equivalent component) inside a solitary statement.
jQuery Method Chaining
Until now we have been composing jQuery proclamations each one in turn (one after the other).
However, there is a method called binding, that enables us to run numerous jQuery directions, in a steady progression, on the equivalent element(s).
To chain an activity, you essentially affix the activity to the past activity.
The following precedent chains together the css(), slideUp(), and slideDown() strategies. The "p1" component first changes to red, at that point it slides up, and afterward it slides down:
We could likewise have included more strategy calls if needed.
Tip: When binding, the line of code could turn out to be very long. In any case, jQuery isn't strict on the language structure; you can organize it like you need, including line breaks and spaces.
This additionally works just fine:
jQuery discards additional whitespace and executes the lines above as one long queue of code.