@cletus, indeed your peace of code works. But I need to use the each on it. 
This for other functions I have. Where I have to do other stuf.
Some more code:
My HTML
 <table id="dgTasks" cellpadding="0" cellspacing="0" class="FullWidthWideContent">
     <thead>
      <tr>
       <th class="checkBox">
    <input type="checkbox" id="chkCheckAll" class="checkBox" />
       </th>
       <th><a href="#" id="ColorCodeBackGround" class="th">Prio</a></th>
       <th><a href="#" id="VisitDate" class="th">Bezoek</a></th>
       <th><a href="#" id="PartyCaseCode" class="th">Dossier</a></th>
      </tr>
  </thead>
  <tbody>
      <tr id="TemplateTr" class="hidden">
       <td class="checkBox">
    <input type="checkbox" name="chkSelectRow" class="checkBox" />
              </td>
       <td> </td>
       <td> </td>        
      </tr>
  </tbody>
 </table>
My function call:
      $(document).ready(function() {
         $("#chkCheckAll").selectAllCheckboxesIn("#dgTasks tbody tr");
         LoadGrid("", false);
         function LoadGrid(SortName, SortDescending) {
            var jTest = $.getJSON("<%=Html.ActionUrlCed("Taskbasket","GetCedTaskListItemList") %>", { sortDescending: SortDescending }, function(data) {
            CreateGrid(data);
        });
      });
In a seperate JS file:
selectAllCheckboxesIn = function(selector) {
    $(this).click(function() {
        var checked = this.checked;
        $(selector + " :checkbox").each(function() {
            $(this).checked = checked;
        });
    });
};
I have a JSON call that returns a list of items.
With that list I do the following.
    function CreateGrid(data) {
        var newRow = $('#TemplateTr').clone();
        newRow.attr("class", "");
        //Remove all rows first
        $("#dgTasks tbody").find("tr:gt(0)").remove();
        $.each(data, function(i, entity) {
            CreateGridRow(newRow.clone(), entity);
        });
        $("#dgTasks tbody").find("tr:gt(0):odd").attr("class", "odd");
    }
The CreateGridRowFunction
    function CreateGridRow(row, entity) {
        if(entity.OverDue){
            row.css("background-color","#FF0000");
        }
        row.find("td:eq(0)").find(':input[type="checkbox"]').attr("id", entity.TaskCode);
        row.find("td:eq(1)").css("background-color","#" + entity.Priority);
        row.find("td:eq(2)").text(entity.Visit);
        row.find("td:eq(3) a").attr("href", "<%=Html.ActionUrlCed("Case","CaseDetail?taskCode=") %>" + entity.TaskCode);
        row.find("td:eq(3) a").text(entity.PartyCaseCode);
        row.find("td:eq(4)").text(entity.Activity);
        row.find("td:eq(5)").text(entity.LicensePlate);
        row.find("td:eq(6)").text(entity.Brand);
        row.find("td:eq(7)").text(entity.DIB);
        row.find("td:eq(8)").text(entity.PartyName);
        row.find("td:eq(9)").text(entity.Zipcode);
        row.find("td:eq(10)").text(entity.Subreports);
        row.find("td:eq(11)").text(entity.Attachments);
        row.find("td:eq(12)").text(entity.MessageTypeOfLastMsgFromAssigner);
        row.find("td:eq(13)").text(entity.Date);
        row.find("td:eq(14)").text(entity.ActionDate);
        $('#dgTasks').append(row);
    }
So if I press the chkCheckAll checkbox it should execute the function.
But for some reason it doesn't do that.
tx for the replies
Steve