English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The general sibling selector (~) selects all sibling elements of the specified element.
Sibling elements must have the same parent, butnextNot necessarily adjacent toAfter prev.
$("prev ~ next")
Select all <p> elements that are siblings of <div> elements:
$("document").ready(function(){ $("div ~ p").css("background", "mediumpurple"); });Test and see‹/›
Parameter | Description |
---|---|
prev | Any valid selector |
next | A selector that filters the elements that are at the same level as the first selector |