Introduction to jQuery
JQuery Syntax
JQuery Effects
JQuery HTML
JQuery Traversing
With jQuery chaining, you can perform multiple actions on the same element in a clean, readable way.
Chaining means combining multiple jQuery methods on the same selector in one line, instead of repeating the selector over and over.
Method chaining allows you to call multiple jQuery methods on the same element in a single statement.
To chain an action, you simply append the action to the previous action.
It helps:
The following example chains together the css()
, slideUp()
, and slideDown()
methods. The "p1" element first changes to red, then it slides up, and then it slides down:
Try it yourself