English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The siblings() method returns all sibling elements of the selected elements.
同级元素必须具有相同的父元素。
Sibling elements must have the same parent element.Please useprev()ornext()
Syntax:
Instance
$("document").ready(function(){ Return all sibling elements for each <li> element with the class 'middle':-color", "lightgreen"); });Test and see‹/›
Return all siblings with the class 'bold' for each list item:
$("document").ready(function(){ $("li").siblings(".bold").css("background-color", "lightgreen"); });Test and see‹/›
Parameter | Description |
---|---|
selectorExpression | An optional selector expression, element, or jQuery object to match elements |