title: Use jQuery to get selected element's hierarchy position/number?
body: <p>Please bear with me. I'm trying my best to explain what I need, but I'll probably need a few updates to my OP.</p>
  
  <p>I want to get the position of a selected element in the hierarchy. For example,
  if I have a total of 4 hyperlinks within the entire html document, and I hover over the third link, I want "html > body > a:eq(2)" - 2 signifying the 3rd hyperlink element. </p>
  
  <p>And no, <code>index()</code> doesn't do the trick.</p>
  
  <p>I have tried <a href="http://jquery4u.com/dom-modification/jquery-hierarchy-path-element/#.T85Jj7BSQXg" rel="nofollow">this code</a> with a little tweaking and get this: "html > body > a", but cannot find a function to return the position.</p>
  
  <p>How do I get the position of the selected element within a hierarchy of similar elements? (I do not even know if that's the right terminology.) Will I need to traverse the DOM and perform a manual match if x==y kinda thing</p>
  
  <pre><code>&lt;a href=#"&gt;link1&lt;/a&gt; 
  &lt;a href=#"&gt;link2&lt;/a&gt; 
  &lt;a href=#"&gt;link3&lt;/a&gt; 
  &lt;a href=#"&gt;link4&lt;/a&gt;
  </code></pre>
  
  <p>I will use this code for all kinds of HTML elements, not just hyperlinks.</p>