Find closest previous sibling with class


/ Published in: jQuery
Save to your folder(s)

$('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".


Copy this code and paste it in your HTML
  1. $('li.current_sub').prevAll("li.par_cat:first");

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.