Question: I'm new to jQuery and I'm having trouble figuring out how to chain selectors. The goal is to select checkboxes that have the '.restricted' class. Here's the output from my JS console:

```
> $("#capability_panel input[type='checkbox']")
[
<input type=​"checkbox" id=​"jbp_product_workshops" value=​"option1">​
, 
<input type=​"checkbox" id=​"jbp_elevate_creators" value=​"option2" class=​"restricted">​
, 
<input type=​"checkbox" id=​"jbp_trainings" value=​"option3">​
, 
<input type=​"checkbox" id=​"jbp_resources_ask" value=​"option4" class=​"restricted">​
, 
<input type=​"checkbox" id=​"jbp_talent_exchange" value=​"option5" class=​"restricted">​
]    

> $("#capability_panel input[type='checkbox'] .restricted")
[]

> $("#capability_panel input[type='checkbox']").find(".restricted")
[]    

```

I must be doing something dumb, right?

Answer: 
jQuery is using CSS selector and more to select element.

That being said, you can achieve what you want with that selector : 

```
$("#capability_panel input[type='checkbox'].restricted");

```

If you want to use a function to get every matching checkbox, you can use [jQuery .filter()](http://api.jquery.com/filter/) :

```
$("#capability_panel input[type='checkbox']").filter('.restricted');

```

The major difference between using filter or selector is based on what you want to achieve. Example, if you want to check every checkbox except the `.restricted` one, you could use :

```
$("#capability_panel input[type='checkbox']").prop('checked', true).filter('.restricted').prop('checked', false);

```

Of course that's a basic example (there is optimal way of doing this).
Selectors in JQuery work like CSS.

If you want the checkbox with the restricted class, you would have to write:
$("#capability\_panel input[type='checkbox'].restricted")

Both $("#capability\_panel input[type='checkbox'] .restricted") and $("#capability\_panel input[type='checkbox']").find(".restricted") will first select checkbox inputs and try to find elements of the restricted class inside them. (