Select Matching Siblings .siblings([selector])

.siblings([selector])

e.g. $("span").siblings()

.siblings([selector]) selects siblings for each element in the matched set, optionally filtered by selector.

Example 1: $("span").siblings() will select all siblings for each element of type <span>.
<div>
  <span>A</span>
  <b>B</b>
  <div>
    <b>C</b>
  </div>
</div>
Example 2: $("span").siblings("b") will only select siblings of type <b> for each element of type <span>.
<div>
  <span>A</span>
  <b>B</b>
  <div>
    <b>C</b>
  </div>
</div>
jQuery traversing tree .siblings([selector])