Detect which child element is clicked
<p>I am trying to find out what values the users pick for my element.</p>

<p>in my variable <code>var1</code>. it contains.</p>

<pre><code>&lt;select&gt;
   &lt;option value='1'&gt;1&lt;/option&gt;
   &lt;option value='2'&gt;2&lt;/option&gt;
   &lt;option value='3'&gt;3&lt;/option&gt;
&lt;/select&gt;

&lt;input type='text'&gt;
&lt;input type='text'&gt;
&lt;input type='text'&gt;
</code></pre>

<p>I can just do <code>var1</code>.value to get the user selected value. </p>

<p>However, I have another <code>var2</code> showing</p>

<pre><code>&lt;div&gt;
  &lt;a href='#' id='1'&gt;test1&lt;/a&gt;
  &lt;a href='#' id='2'&gt;test2&lt;/a&gt;
  &lt;a href='#' id='3'&gt;test3&lt;/a&gt;
&lt;/div&gt;
</code></pre>

<p>I want to get the selected <code>id</code> from the <code>&lt;a&gt;</code>
I am not sure how to get it. </p>

<p>Does anyone has an idea? Thanks a lot.</p>
