<div class="top">
<div class="branch">
<div class="branch">
<div class="leaf">click</div>
</div>
</div>
</div>
When I click on the inner most <div class="leaf">,how to get all its way from top to itself:
top,branch,branch,leaf
EDIT to clarify I want to have the path in an array:
arr[0]='top';
arr[1]='branch';
arr[2]='branch';
arr[3]='leaf';
Is there an easy solution?