I have some divs that are collapsible by a click toggle.

CLOSED/COLLAPSED

```
<div class="item-group-condensed context_module     editable_context_module     has_requirements      student-view collapsed_module" aria-label="Service Desk Module" data-workflow-state="active" data-module-url="/courses/2/modules/37" data-module-id="37" id="context_module_37" style="">

```

OPEN

```
<div class="item-group-condensed context_module editable_context_module           student-view context_module_hover" aria-label="Practice Module" data-workflow-state="active" data-module-url="/courses/2/modules/40" data-module-id="40" id="context_module_40" style="">

```

When they are collapsed they have a class .collapsed\_module

I want to loop through them and if they do not have that class do something. In my example below they are ALL red, not just the ones who are missing the class.

```
if (!$(".item-group-condensed").hasClass("collapsed_module")) {
    $(".item-group-condensed .ig-header span.ig-header-title span.name").css("color", "red");
}

```

Do I need to put this into an each()? Any help would be appreciated.