Well, your question is unclear, but it seems that you are looking for a way to traverse a treeview control to get a breadcrumb-style representation of a selected tree node.
Try this fiddle:
http://jsfiddle.net/Wc46w/[
^]
Here's the jQuery algorithm that recursively collects all the anchor text:
$(function() {
var breadCrumb = getAnchorText($('.selected'));
$('.results').text(breadCrumb);
function getAnchorText(item) {
var result = '';
var parentUL = item.parent().parent();
if (parentUL.parent().length == 1) {
var parentAnchor = parentUL.prev('a');
if (parentAnchor.length == 1) {
result = getAnchorText(parentAnchor) + ' -> ';
}
}
result += item.text();
return result;
}
});