I have a container where I have checkboxes. I have a select all checkbox outside the container. 

```
<tr>
<td width="33%">Category <br> <input type="checkbox" id="all_cat" name="catChkBox" class="ckbox"/> Select All/ Unselect All  </td>
</tr>
    <tr>
    <td width="50%" valign="top" id="catTd">
                                        <div class="container" id="categoryContainer"></div>
                                    </td>
    </tr>

```

Using DWR call i get the checkbox values to be filled in , inside the container.

```
... function(data.... // data has got the values to be displayed in container with checkboxes
for(var i=0; i<data.length; i++)
{
$('#catContainer').append('<input type="checkbox" data-name="' + data[i].id + '" name="catChkBox" class="ckbox" id = "' + data[i].id + '" value="' + data[i].id + '" /> ' + data[i].name + '<br/>');
list = data[i].name;
catSL.push(data[i].id);
}
categories = $("input[name=catChkBox]:checked").map(function () {
return $(this).data('name');
}).get();
}, errorHandler:function(){
},async:false
});

```

I want to do select all option now. When I click on the select all checkbox outside the container, it should select the checkboxes inside the container. Similarly for unselect all. I tried the below code, but it dosent work. 

```
$('#all_cat').click( function(){
    for(var i=0; i<categoryData.length; i++)  //categoryData is the data which i get from dwr call
    {
    $(categoryData[i].id ).prop('checked', isChecked('all_cat'));
    }
    });
function isChecked(checkboxId) {
    var id = '#' + checkboxId;
    return $(id).is(":checked");
}

```

Any help ?????