title: javascript onclick get the div id?
body: <p>Is it possible to get the ids of the 2 div tags on clicking the button, using javascript?</p>
  
  <pre><code>&lt;div id="main"&gt;
  &lt;div id="content"&gt;
  &lt;/div&gt;
  &lt;button onclick="function();"&gt;show it&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I have 2 div tags here. The 1st div is in the main div while the content div is inside the main div and the button is inside the main div as well.</p>
  
  <p>Is it possible to get the <strong><em>main</em></strong> and <strong><em>content</em></strong> id of the 2 div tags on clicking the button?</p>
  
  <p>EXPECTED OUTPUT when I press the button:</p>
  
  <blockquote>
  <pre><code>alert: main
  alert: content
  </code></pre>
  </blockquote>