title: Index of Child DOM element within Parent
body: <p>I'm looking for a pure JS way of finding the offset of a child within it's parent.</p>
  
  <p>Given the below sample:</p>
  
  <pre><code>&lt;div&gt;
  A 
  &lt;br&gt;
  short space elapsed, &lt;b&gt;and&lt;/b&gt; up into this noiselessness came Ahab alone from his cabin. 
  
  &lt;span&gt;Taking a few turns on the quarter-deck, he paused to gaze over the side&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I would get 3 children, a <code>br</code>, <code>b</code>, and <code>span</code>. Each would need to have an offset to the start of the <code>div</code> - So the index of how many characters into the div the start of the tag is.<br>
  So the <code>br</code> would have an offset of 2.</p>
  
  <p>My initial idea was to get all the <code>children</code> of the div, then somehow from that be able to easily get an index.</p>