Get the App
SLTechnology News&Howtos  ›  Development  › 

What is jquery sibling?

Shulou Source: shulou.com Published: 2022-06-02 15:20:33 09月25日 Update

This article mainly explains "what is jquery sibling". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is jquery sibling".

Jquery sibling is a jquery method that returns all siblings of the selected element, using syntax such as "$(selector) .siblings (filter)", and the parameter filter specifies a selector expression that narrows the search for siblings.

This article operating environment: windows7 system, jquery3.2.1 version, DELL G3 computer

What does jquery sibling mean?

JQuery siblings () method:

The siblings () method returns all siblings of the selected element.

Sibling elements are elements that share the same parent element.

DOM tree: this method traverses forward and backward along the siblings of the DOM element.

Tip: use the prev () or next () method to narrow the search for only the previous or later sibling element.

Grammar

$(selector) .siblings (filter)

Parameters.

Filter is optional. Specifies a selector expression that narrows the search for sibling elements.

Example

Returns all siblings of each element with the class name "start":

$(document) .ready (function () {$("li.start"). Siblings (). Css ({"color": "red", "border": "2px solid red"});})

Results:

Ul (parent) li (sibling) li (sibling) li (sibling with class name "start") li (sibling) li (sibling) Thank you for your reading, the above is the content of "what is jquery sibling?" after the study of this article, I believe you have a deeper understanding of what jquery sibling is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Elements siblings methods scope learning search content parameters expressions syntax selection same examples that is ideas situations meaning articles more environment Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info MariaDB MySQL Docker Shulou Information