jQuery element ~ siblingsSelector
Examples
Select all <p> elements that are siblings of <div> elements:
$("div ~ p")
Try it Yourself »
Definition and Usage
The ("element ~ siblings") selector selects all elements that are siblings of the specified element "element".
For example:
- $("div ~ p")- Select all <p> elements that are siblings of <div> elements.
Note:The two specified elements share the same parent element.
Syntax
("element ~ siblings")
| Parameter | Description |
|---|---|
| element | Required. Any valid jQuery selector. |
| siblings | Required. Specifieselementthe siblings of the parameter. |
Other Extensions
jQuery Selector