Jquery .addClass('myclass') Then Selecting 'myclass' Isn't Working
<p>I've got a couple divs with the class "listingThumb"</p>

<p>the CSS:</p>

<pre><code>.listingThumb{
height:50px;
width:50px;
overflow:hidden;
}
</code></pre>

<p>the Html:</p>

<pre><code>&lt;div class="listingThumb"&gt;&lt;img src="mypic.jpg"&gt;&lt;/div&gt;
</code></pre>

<p>I want a user to be able to click that div and add a border that I have in another class that I add with .addClass()</p>

<pre><code>.selectedThumb{
border:1px #f00 solid;
}
</code></pre>

<p>With this function:</p>

<pre><code>$('.listingThumb').live('click',
    function(){
        $(this).addClass('selectedThumb');
    }
);
</code></pre>

<p>That all works fine and dandy.  My problem is that I want the selected div to switch when a user clicks another div.  So, what I do with my function is this...</p>

<pre><code>$('.listingThumb').live('click',
    function(){
        $('.listingThumb').removeClass('selectedThumb'); // &lt;-- remove any instance of that class...
        $(this).addClass('selectedThumb');
    }
);
</code></pre>

<p>But, any div that I've added 'selectedThumb' to via jquery doesn't register as having that class as it was added dynamically. </p>

<p>Is there a common solution for this?</p>

<p>Thanks
-J</p>
