Skip to content Skip to sidebar Skip to footer

Traversing An Html Nested List, Follow-up Question - Detecting A Node's Position

With reference to to an previous question of mine: link I have an additional question, as follows: I need the ability to start the 'position' at a point within the tree. Users can

Solution 1:

Use window.location.hash to get the element, find it and then use index() on your list of <li> elements to get its index/position.

var node = $(window.location.hash),
    index = $('li').index(node);

Post a Comment for "Traversing An Html Nested List, Follow-up Question - Detecting A Node's Position"