Sorry if the title is confusing, I'm very new to Javascript & Jquery so it's hard to find the right way to ask a question sometimes.

Here's the situation:

I've got a lot of divs all with a class of thumbnail:

```
<div class="thumbnail">

```

Additionally, some of those classes may be expanded at any given time, like so: 

```
<div class="thumnail expanded">

```

This all works great and they expand as needed. 

I'd like to add some logic that fires on click, when a user clicks any of these thumbnails to expand it: 

```
$( ".thumbnail a" ).click(function() {
});

```

This check works fine, and I can fire a popup on click that registers the thumbnail anchor clicks like a charm.

What I don't know is how to check for any instances of thumbnail which also have a class of expanded, and remove that class. I tried something like:

```
$( ".thumbnail .expanded").removeClass("expanded");

```

Within the thumbnail click check, but to no avail. Not quite sure what I'm missing here, so help would be greatly appreciated. Thanks!