jQuery Chain Selectors

jQuery - Chain Selectors

jQuery Chain selectors provide a chaining method that allows us to perform multiple jQuery methods on the same element, within a single statement.

jQuery Chaining methods

Jquery chaining method allows us to add more than the jquery method to the same element, within a single statement.

Jquery chaining method improves the performance of the code since it could not search elements again and again.

Basically, it is a process of attaching the method to the previous method of the selected element.

How Jquery Chaining Method Is Work ?

Please keep in mind that every jquery chaining method returns a jquery object. This is the core concept behind the chaining method.

General Syntax


Source Code

Try it now

In the above example, the first <p> element slides up and then slides down.

jQuery Chaining Method Code Formatting

jQuery chaining method, a single line of code can be broken into multiple lines of code for greater readability.

Source Code

Try it now
....