nikolaichIl,
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script>
$(function(){
function fn(str, el) {
var arr = [],
str = "li:contains(" + str + ")",
el = $(el);
while (el.find(str).length) {
el = el.find(str);
i = el.siblings().add(el).index(el);
arr.push(i)
}
return arr
};
var str = "Sub Item 2.2"
alert(fn(str, "#navid").join(" => "))
});
</script>
</head>
<body>
<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><a href="#">Sub Item 2.2</a></li>
<li><a href="#">Sub Item 2.3</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</body>
</html>