jQuery click event when an element is inside another element
<p>I have a problem with the jQuery click event when an element is inside another element. The code I am using is similar to the following:</p>

<pre><code>&lt;div class="a" id="a"&gt;
  &lt;a class="b" id="b"&gt;&lt;/a&gt;
&lt;/div&gt;

$(".a,.b").click(function() {
  var current_id = $(this).attr("id"); 
  alert(current_id);
  ...do something...
});  
</code></pre>

<p>When I click on the  tag class="b" it returns the encapsulated class="a" id instead of the id of class="b". How do I code it so that when I click on class="a" or class="b" it returns the correct corresponding id value?</p>
