jQuery siblings method : jQuery “siblings() Method ” is used to get all siblings of the selected element. It returns the all siblings of the selected element. It accepts one parameter as filter which is optional. We are going to explain this method with the help of example and demo.
Syntax : jQuery siblings method
Syntax of siblings method
$(selector).siblings(filter);
filter : It is optional, A selector expression is used to match(siblings) the elements against.
jQuery siblings Method Example
Here is an example of siblings method Click on Try it button to see the output-
The above example will produce the following output-
Note : Below out is produced when you click on the Click to run siblings() Example button. To experience this demo click on the above “Try it” button.