Return to Snippet

Revision: 39999
at January 24, 2011 22:04 by lamebollock


Initial Code
$('li.current_sub').prevAll("li.par_cat:first");

Initial URL
http://stackoverflow.com/questions/2310270/jquery-find-closest-previous-sibling-with-class

Initial Description
$('li.current_sub').prevAll("li.par_cat:first");

Tested it with your markup:

$('li.current_sub').prevAll("li.par_cat:first").text("woohoo");

will fill up the closest previous li.par_cat with "woohoo".

Initial Title
Find closest previous sibling with class

Initial Tags
jquery

Initial Language
jQuery