Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery element ~ siblings Selector

jQuery element ~ siblings Selector

jQuery selector jQuery selector

Example

Select

all siblings of the ... element

element:

$("div ~ p")

Try it »


Definition and Usage

The ("element ~ siblings") selector selects all elements that are siblings of the specified "element".

For example:

  • $("div ~ p") - Select the
    all siblings of the ... element

    .

**Note:** The two specified elements share the same parent element.


Syntax

("

element

~

siblings

")

Parameters Description
element Required. Any valid jQuery selector.
siblings Required. Specifies a element siblings of the ... parameter.

jQuery selector jQuery selector