jQuery - prev()

The prev() method returns the previous sibling element of the selected element.

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

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