title: Why is parentNode undefined?
body: <p>I'm trying to write a function that takes an ID then traverses up the DOM to see if that item is a child of a tag. This shouldn't be too hard however my <code>parentNode</code> is coming back as <code>undefined</code>? What am I missing?</p>
  
  <p>Here's a simplified version of my code... thanks in advance.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;body&gt;
  
  &lt;div id="top"&gt;
      &lt;div id="top2"&gt;&lt;/div&gt;
  
      &lt;div id="top3"&gt;&lt;/div&gt;
  
      &lt;div id="top4"&gt;&lt;/div&gt;
  
      &lt;div id="top5"&gt;
          &lt;div id="top5_1"&gt;&lt;/div&gt;
      &lt;/div&gt;
      &lt;div id="top6"&gt;
              &lt;div id="top6_1"&gt;
                  &lt;a href="" id="findMe"&gt;here I am...&lt;/a&gt;
              &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;script&gt;
  
  function findParent(startID, finish){
  
  // change this from id to tag 
  start = document.getElementById(startID).tagName;
  
      while (start.parentNode) {
          start = start.parentNode;
  
          if (start.tagName === finish){
              console.log("true " + startID + " is a child of " + finish);
  
          }else{
              console.log("false " + startID + " ISN'T a child of " + finish);
          }
  
      }
  }
  
  findParent("findMe", "BODY");
  
  
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>