jQuery: Check if an element is assigned to a var
<p>I'm trying to create a simple button manager to select and eventually unselect allready checked <code>img</code> elements which contains CSS class <code>.my_class</code>, why this doesn't work?</p>

<pre><code>var last_selected;
$("img.my_class").click ( function () {
    if (last_selected != null) alert ($(this) == last_selected); // returns false everytime
    last_selected =  $(this);
});
</code></pre>
