Find closest previous sibling with class

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


Tested it with your markup:


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");


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.