title: Javascript obtain outer parent id DIV
body: <p>I have a structure that looks like the one below, I'm trying to get the id <code>foo</code>. It is the <strong>only</strong> <code>DIV</code> with id if we bubble up from the <code>onclick</code> <code>func()</code>, which means that there wont be other <em>DIVs</em> that contain an id inside <code>foo</code>. However, there can be other tags inside <code>foo</code> that contain an id (such as <code>bye, hello</code>).</p>
  
  <p>No frameworks are being used. </p>
  
  <pre><code>&lt;div id="bar"&gt;&lt;/div&gt;
  &lt;div id="foo"&gt;
      &lt;p&gt;&lt;p&gt;
      &lt;div class="bye"&gt;
          &lt;input id="bye" type="text" value="test" /&gt;  
          &lt;input id="hello" type="text" value="test" /&gt;
          &lt;table&gt;
              &lt;tr&gt;&lt;td onclick="func(event)"&gt;1&lt;/td&gt;&lt;/tr&gt;
              &lt;tr&gt;&lt;td onclick="func(event)"&gt;2&lt;/td&gt;&lt;/tr&gt;
          &lt;/table&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>