Chaining allows multiple jQuery methods (on the same element) to be allowed in a single statement.
JQuery Method Links
Until now, write one jQuery statement at a time (one after the other).
However, there is a technique called link (chaining) that allows multiple jQuery commands to be run on the same element, one after the other.
Example 1
The following example links CSS (), Slideup (), and Slidedown () together. The "P1" element first turns red, then slides up, then slides:
1 $ ("#p1"). CSS ("Color", "red"). Slideup (+). Slidedown (+);
1 <!DOCTYPE HTML>2 <HTML>3 <Head>4 <Scriptsrc= "Jquery-2.2.0.min.js"></Script>5 <Script>6 $ (document). Ready (function(){7 $("Button"). Click (function(){8 $("#p1"). CSS ("Color","Red"). Slideup ( -). Slidedown ( -);9 })Ten }) One </Script> A </Head> - - <Body> the - <PID= "P1">JQuery is fun!</P> - <Button>Click here</Button> - + </Body> - </HTML>
Jquery-chaining Link Technology