jQuery's event.target not working from inside a function
<pre><code>&lt;a href="javascript:getClassName();" class="link"&gt;Click here&lt;/a&gt;
</code></pre>

<p>I know it is possible to get the class name with the code below:</p>

<pre><code>$('a').click(function() {
    alert($(this).attr('class'));
})
</code></pre>

<p>I want to be able to use <code>$(this)</code> inside a function called <code>getClassName()</code> with the help of <code>event.target</code>. But, this doesn't seem to work. I always get an error: </p>

<blockquote>
  <p>target is undefined</p>
</blockquote>

<p>The function that I'm using is:</p>

<pre><code>function getClassName(event) {
    el = $(event.target);
    alert(el.attr('class'));
}
</code></pre>

<p><strong>And I don't want to use the <code>event.target</code> binding on <code>$(body)</code>.</strong></p>
