event.target

event.target

Hi all,

Please consider the following code;
  1. $("#content").click(function(event)
  2. {
  3.       if($(event.target).is('a'))
  4.       {
  5.             $(this).//do something
  6.       }
  7. }
I'm binding a click event to a div so that I can see whether is was the div or some element inside the div that has been clicked. When the if() in my code evaluates to true $(this) is still equal to $("#content") whereas I'd like to have the clicked anchor as matched element. How would I do this?