Check out this fiddle to see the code snippet: http://jsfiddle.net/3mpire/yTzGA/1/
I am using jQuery and I need to figure out how to remove the "active" class from all LIs except for the one that is deepest within the hierarchy.
<div class="navpole">
<ul>
<li class="active"><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a>
<ul>
<li class="active"><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a>
<ul>
<li class="active"><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
</ul>
</li>
<li><a href="#">Lorem ipsum</a></li>
</ul>
</li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
</ul>
</div>
This is what I want the outcome to look like:
<div class="navpole">
<ul>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a>
<ul>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a>
<ul>
<li class="active"><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
</ul>
</li>
<li><a href="#">Lorem ipsum</a></li>
</ul>
</li>
<li><a href="#">Lorem ipsum</a></li>
<li><a href="#">Lorem ipsum</a></li>
</ul>
</div>