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 select a node within the tree by way of a hash (e.g. #post9) – they can click a node anywhere in the list to select it, or they can bookmark the url, which would include that node’s own hash.
So my further question is: how would I locate a node within the tree and get it’s position, using the hash in the URL? The hash in the URL correlates with the id of the <li> node.
Many thanks in advance.
Use
window.location.hashto get the element, find it and then useindex()on your list of<li>elements to get its index/position.