<div id="navid" class="navclass">
<ul>
<li>Folder 1
<ul>
<li><a href="#">Sub Item 1.1</a></li>
<li><a href="#">Sub Item 1.2</a></li>
<li>Folder 2
<ul>
<li><a href="#">Sub Item 2.1</a></li>
<li id="el"><a href="#">Sub Item 2.2</a></li>
<li><a href="#">Sub Item 2.3</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
var $el = $("#el");
var positions = [$el.index()];
var values = [$.trim($el.text())];
$("#el").parents("li").each(function() {
$this = $(this);
positions.unshift($this.index());
var html = $this.html();
var position = html.indexOf("<", 1);
values.unshift($.trim(html.slice(0, position)));
});
result = "positions: " + positions + "; values: " + values;
alert(result);