Moving up multiple parents in jQuery - more efficient way?
So, I have a navigation that is a list and has sublists and sublists. Basically, the nav is by default collapsed, but if people click on a page that's in a sublist, I want to show the parent list. And if it's a sublist of a sublist, I need both parent lists to show. I have it set up, but, I don't like putting 5 .parent().parent() 's to traverse upward to expand the list. Is there a more efficient way? the HTML: <div id="lesson-sidebar"> <ul> <li><a href="index.html">Welcome to Beat Basics and Beyond</a></li> <li><a href="table-of-contents.html">What's in this course?</a></li> <li><a href=