I am needing help forming a jquery selector to return elements which are missing a particular child element.

Given the following HTML fragment:

```
    <div id="rack1" class="rack">
    <span id="rackunit1" class="rackspace">
        <span id="component1">BoxA</span>
        <span id="label1">Space A</span>
    </span>
    <span id="rackunit2" class="rackspace">
        <span id="label2">Space B</span>
    </span>
    <span id="rackunit3" class="rackspace">
        <span id="component2">BoxA</span>
        <span id="label3">Space C</span>
    </span>
</div>
<div id="rack2" class="rack">
    <span id="rackunit4" class="rackspace">
        <span id="component3">BoxC</span>
        <span id="label4">Space D</span>
    </span>
    <span id="rackunit5" class="rackspace">
        <span id="label5">Space E</span>
    </span>
    <span id="rackunit6" class="rackspace">
        <span id="component4">BoxD</span>
        <span id="label6">Space F</span>
    </span>
</div>

```

Find for me the rackunit spans with NO component span.
Thus far I have:
$(".rack .rackspace") to get me all of the rackunit spans, not sure how to either exclude those with a component span or select only those without one...
['https://Stackoverflow.com/questions/14482707', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/681009/']
I guess the following should work:

```
$(".rack .rackspace:not(:has(span[id^=component]))"). ...

```

**DEMO:** <http://jsfiddle.net/WbCzj/>
You could use [`.filter()`](http://api.jquery.com/filter/):

```
$('.rack .rackspace').filter(function() {
    return $(this).find('span[id^="component"]').length === 0;
});

```