What is siblings() in JQuery?

siblings() or elem.siblings() is a JQuery method that gets the siblings of an element. The siblings of an element are elements that have the same parent as the element in question.

Syntax

element.siblings([function])

Parameter

[function]: The siblings() function can take an optional function.

Code

In the example below, when you click the button, all the siblings of the button element are given a new CSS value.

Free Resources