.hasClass() seem to always return true when used inside a .click() function, why?
<pre><code>&lt;ul id="list"&gt;
    &lt;li&gt;item 1&lt;/li&gt;
    &lt;li&gt;item 2&lt;/li&gt;
&lt;/ul&gt;

$('#list li').click(function () {
    alert($(this).hasClass('active')); // supposed to be an if
    $(this).parent('ul').children('li').removeClass('active');
    $(this).addClass('active');
});
</code></pre>

<p>Why does "$(this).hasClass('active')" always return true?</p>
