jQuery - siblings

The siblings() method returns all sibling elements of the selected element. Siblings as in the sense of all matches of the declared element which are the same level. It will exclude the one you declare but find it's siblings. It will find matches both above and below the declared element.

  • list item 1
  • list item 2
  • list item 3
  • list item 4
  • list item 5

$("#btnDemo").click(function ()
{
    $("li.third-item").siblings().css({ "font-weight": "bold", "color": "red" });
});