Question: I know there is multiple questions about this, but I have a different problem here, I have an accordion menu inside of another accordion menu, and there is checkboxes on each title, here is a simplified [fiddle](http://jsfiddle.net/Salameche/wDnAd/62/) where the problem is quite obvious: I want the last checkbox to check all the other ones, including the ones inside the accordion

Simplified code (without the accordion which is useless in my issue):

```
<form>
  <label><input type="checkbox" class="btn1" checked />importTitle</label>
  <label><input type="checkbox" id="selectall" class="btn1"/> Import all 
positions</label>

  <div id="checkboxlist">
    <label><input type="checkbox" class="btn" checked/>Import a</label><br />
    <label><input type="checkbox" class="btn" checked/>Import b</label><br />
    <label><input type="checkbox" class="btn" checked/>Import c</label><br />
    <label><input type="checkbox" class="btn" checked/>Import d</label><br />
  </div>
  <label><input type="checkbox" class="btn1" checked /> Import Link</label>
  <label><input type="checkbox" class="btn1" id="selectAll"/>Import everything</label>
</form>

```

and the js: 

```
$('#selectall').click(function() {
  $(this.form.elements).filter('.btn').prop('checked', this.checked);
});
$('#selectAll').click(function() {
  $(this.form.elements).filter('.btn1').prop('checked', this.checked);
});

```

Answer: 
You can filter all checkboxes instead of using a class based filter so

```
$('#selectAll').click(function() {
  $(this.form.elements).filter(':checkbox').prop('checked', this.checked);
});

```

---

Or if you still wants to use the class selector, pass both the classes like

```
$('#selectAll').click(function() {
  $(this.form.elements).filter('.btn, .btn1').prop('checked', this.checked);
});

```
Try this: 

```
$('#selectAll').on('click', function() {  
      var check_status = this.checked;

      if (check_status == true) {
          $(".btn").prop("checked", true);
      } else {
          $(".btn").prop("checked", false);
      }
});

```